From e57c41545cabbb0912dd13d9db8eaaadd1612f6c Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Fri, 4 Mar 2022 22:10:21 +0900 Subject: 2021/09/15 時点の英語版に基づき新規翻訳 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/api/stylepropertymapreadonly/has/index.md | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 files/ja/web/api/stylepropertymapreadonly/has/index.md (limited to 'files/ja') diff --git a/files/ja/web/api/stylepropertymapreadonly/has/index.md b/files/ja/web/api/stylepropertymapreadonly/has/index.md new file mode 100644 index 0000000000..1014a7671a --- /dev/null +++ b/files/ja/web/api/stylepropertymapreadonly/has/index.md @@ -0,0 +1,55 @@ +--- +title: StylePropertyMapReadOnly.has() +slug: Web/API/StylePropertyMapReadOnly/has +tags: + - API + - CSS Typed Object Model API + - 実験的 + - Houdini + - メソッド + - リファレンス + - StylePropertyMapReadOnly + - has() +browser-compat: api.StylePropertyMapReadOnly.has +translation_of: Web/API/StylePropertyMapReadOnly/has +--- +{{APIRef("CSS Typed Object Model API")}}{{SeeCompatTable}} + +**`has()`** は {{domxref("StylePropertyMapReadOnly")}} インターフェイスのメソッドで、指定されたプロパティが `StylePropertyMapReadOnly` オブジェクトにあるかどうかを示します。 + +## 構文 + +```js +var boolean = StylePropertyMapReadOnly.has(property) +``` + +### 引数 + +- property + - : プロパティの名前です。 + +### 返値 + +論理値です。 + +## 例 + +ここでは、 `has()` メソッドを使用して、 padding-top プロパティが button 要素の style 属性に存在するかどうかを確認します。 + +```js +// button 要素を取得 +const buttonEl = document.querySelector('.example'); + +// style 属性内のものを attributeStyleMap および has() で検索 +const hasPadTop = buttonEl.attributeStyleMap.has('padding-top); + +console.log(hasPadTop); // padding-top が style 属性にあれば true を記録 +``` + +## 仕様書 + +{{Specifications}} + +## ブラウザーの互換性 + +{{Compat}} -- cgit v1.2.3-54-g00ecf