From 33d52ff611c0da0039a2c07ebd7ca0c9645e2cff Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Sun, 18 Apr 2021 00:31:39 +0900 Subject: DOMTokenList.supports を新規翻訳 (#424) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2021/03/11 時点の英語版に基づき新規翻訳 --- files/ja/web/api/domtokenlist/supports/index.html | 69 +++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 files/ja/web/api/domtokenlist/supports/index.html diff --git a/files/ja/web/api/domtokenlist/supports/index.html b/files/ja/web/api/domtokenlist/supports/index.html new file mode 100644 index 0000000000..31af1e1455 --- /dev/null +++ b/files/ja/web/api/domtokenlist/supports/index.html @@ -0,0 +1,69 @@ +--- +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
+
{{domxref("DOMString")}} で、問い合わせるトークンが入ります。
+
+ +

返値

+ +

{{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")}}

-- cgit v1.2.3-54-g00ecf