From 52c12c1c3a8a92091f5caadf2cd1cc632b345d39 Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Sun, 18 Jul 2021 23:58:20 +0900 Subject: Web/API/CSSStyleDeclaration 以下を更新 (#1482) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Web/API/CSSStyleDeclaration/cssText を新規翻訳 2021/06/13 時点の英語版に基づき新規翻訳 * Web/API/CSSStyleDeclaration 以下を整備 Web/API/CSSStyleDeclaration 以下について、2021/07/10時点の内容に同期。未翻訳の記事については新規翻訳 --- files/ja/web/api/cssstyledeclaration/index.html | 108 ++++++++---------------- 1 file changed, 37 insertions(+), 71 deletions(-) (limited to 'files/ja/web/api/cssstyledeclaration/index.html') diff --git a/files/ja/web/api/cssstyledeclaration/index.html b/files/ja/web/api/cssstyledeclaration/index.html index 7055ef0943..43e40972cb 100644 --- a/files/ja/web/api/cssstyledeclaration/index.html +++ b/files/ja/web/api/cssstyledeclaration/index.html @@ -1,66 +1,68 @@ --- title: CSSStyleDeclaration slug: Web/API/CSSStyleDeclaration +tags: + - API + - CSSOM + - CSSRule + - Interface + - Reference +browser-compat: api.CSSStyleDeclaration translation_of: Web/API/CSSStyleDeclaration ---
{{APIRef("CSSOM")}}
-

CSSStyleDeclarationインターフェースはCSS宣言ブロックオブジェクトを表し、スタイル情報やスタイル関連のメソッド、プロパティを提供します。

+

CSSStyleDeclaration インターフェースは CSS 宣言ブロックのオブジェクトを表し、スタイル情報や様々なスタイルに関するメソッドやプロパティを提供します。

-

CSSStyleDeclaration オブジェクトは下記の3つのAPIによって使用されます。

+

CSSStyleDeclaration オブジェクトは、下記の 3 つの API によって使用されます。

属性

{{DOMxRef("CSSStyleDeclaration.cssText")}}
-
Textual representation of the declaration block. Setting this attribute changes the style.
- CSSブロック宣言をテキスト表示する。この属性を与えることでスタイルを変化させることが可能。
+
宣言ブロックのテキスト表現です。この属性を設定すると、スタイルが変化します。
{{DOMxRef("CSSStyleDeclaration.length")}}{{ReadOnlyInline}}
-
プロパティの数を表す。後述の{{DOMxRef("CSSStyleDeclaration.item()", 'item()')}}メソッドを参照のこと。
-  
+
プロパティの数を表します。後述の {{DOMxRef("CSSStyleDeclaration.item()", 'item()')}} メソッドを参照のこと。
{{DOMxRef("CSSStyleDeclaration.parentRule")}}{{ReadOnlyInline}}
-
{{DOMxRef("CSSRule")}}を含むコンテナを表す。
+
所属する {{DOMxRef("CSSRule")}} を表します。
-

CSS プロパティ

+

CSS プロパティ

-
{{DOMxRef("CSSStyleDeclaration.named_properties", "CSSStyleDeclaration.cssFloat")}}
-
{{CSSxRef("float")}} CSSプロパティのエイリアス。
-
{{DOMxRef("CSSStyleDeclaration.named_properties", 'CSSStyleDeclaration named properties', "", 1)}}
-
全てのCSSプロパティに対して、その値を取得する。
+
{{DOMxRef("CSSStyleDeclaration.cssFloat", "CSSStyleDeclaration.cssFloat")}}
+
CSS の {{CSSxRef("float")}} プロパティのエイリアスです。
+
{{DOMxRef("CSSStyleDeclaration.named_properties", 'CSSStyleDeclaration の名前付きプロパティ', "", 1)}}
+
対応するすべての CSS プロパティを、ダッシュおよびキャメルケースにした属性です。
-

メソッド

+

メソッド

{{DOMxRef("CSSStyleDeclaration.getPropertyPriority()")}}
-
Returns the optional priority, "important".
+
オプションの優先度、 "important" を返します。
{{DOMxRef("CSSStyleDeclaration.getPropertyValue()")}}
-
Returns the property value given a property name.
+
指定されたプロパティ名のプロパティ値を返します。
{{DOMxRef("CSSStyleDeclaration.item()")}}
-
Returns a CSS property name by its index, or the empty string if the index is out-of-bounds.
-
An alternative to accessing nodeList[i] (which instead returns undefined when i is out-of-bounds). This is mostly useful for non-JavaScript DOM implementations.
+
位置から CSS プロパティ名を返します。位置が範囲を超えていた場合は空文字列を返します。
+
代替方法は nodeList[i] にアクセスすることです (これは i が範囲外であった場合は undefined を返します)。これは JavaScript 以外の DOM 実装の多くで最も有用です。
{{DOMxRef("CSSStyleDeclaration.removeProperty()")}}
-
Removes a property from the CSS declaration block.
+
CSS 宣言ブロックからプロパティを削除します。
{{DOMxRef("CSSStyleDeclaration.setProperty()")}}
-
Modifies an existing CSS property or creates a new CSS property in the declaration block.
-
{{DOMxRef("CSSStyleDeclaration.getPropertyCSSValue()")}} {{Obsolete_Inline}}
-
Only supported via getComputedStyle in Firefox. Returns the property value as a {{DOMxRef("CSSPrimitiveValue")}} or null for shorthand properties.
+
宣言ブロック内の既存の CSS プロパティを変更するか、新しい CSS プロパティを生成するかします。
+
{{DOMxRef("CSSStyleDeclaration.getPropertyCSSValue()")}} {{deprecated_inline}}
+
Firefox の getComputedStyle のみ対応 プロパティの値を {{DOMxRef("CSSPrimitiveValue")}} として、または一括指定プロパティでは null を返します。
-

+

-
var styleObj = document.styleSheets[0].cssRules[0].style;
+
var styleObj = document.styleSheets[0].cssRules[0].style;
 console.log(styleObj.cssText);
 
 for (var i = styleObj.length; i--;) {
@@ -70,52 +72,16 @@ for (var i = styleObj.length; i--;) {
 
 console.log(styleObj.cssText);
-

仕様

+

仕様書

- - - - - - - - - - - - - - - - - - - - -
仕様ステータスコメント
{{SpecName('CSSOM', '#the-cssstyledeclaration-interface', 'CSSStyleDeclaration')}}{{Spec2('CSSOM')}}Merged the DOM Level 2 Style CSS2Properties interface into CSSStyleDeclaration.
{{SpecName('DOM2 Style', 'css.html#CSS-CSSStyleDeclaration', 'CSSStyleDeclaration')}}{{Spec2('DOM2 Style')}}Initial definition
+{{Specifications}} -

ブラウザー実装状況

+

ブラウザーの互換性

+

{{Compat}}

- -

{{Compat("api.CSSStyleDeclaration")}}

- -

関連情報

+

関連情報

- -
-
-
-
- -
- -
-
- -
-
-
-- cgit v1.2.3-54-g00ecf