--- title: DOMTokenList.supports() slug: Web/API/DOMTokenList/supports tags: - API - DOM - Method - Reference translation_of: Web/API/DOMTokenList/supports ---
{{APIRef("DOM")}}{{SeeCompatTable}}
supports() は {{domxref("DOMTokenList")}} インターフェイスのメソッドで、渡された token が関連する属性で対応しているトークンに含まれていれば true を返します。このメソッドは機能に対応しているかを検出するためのものです。
let trueOrFalse = element.supports(token)
token{{jsxref("Boolean")}} で、トークンが見つかったかどうかを返します。
let iframe = document.getElementById('display');
if (iframe.sandbox.supports('an-upcoming-feature')) {
// support code for mystery future feature
} else {
// fallback code
}
if (iframe.sandbox.supports('allow-scripts')) {
// instruct frame to run JavaScript
//
// (NOTE: This feature is well-supported; this is just an example!)
//
}
| 仕様書 | 状態 | 備考 |
|---|---|---|
| {{SpecName('Credential Management')}} | {{Spec2('Credential Management')}} | 初回定義 |
{{Compat("api.DOMTokenList.supports")}}