diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/ja/web/api/cssstyledeclaration | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/ja/web/api/cssstyledeclaration')
3 files changed, 253 insertions, 0 deletions
diff --git a/files/ja/web/api/cssstyledeclaration/getpropertycssvalue/index.html b/files/ja/web/api/cssstyledeclaration/getpropertycssvalue/index.html new file mode 100644 index 0000000000..f3ce66652d --- /dev/null +++ b/files/ja/web/api/cssstyledeclaration/getpropertycssvalue/index.html @@ -0,0 +1,65 @@ +--- +title: CSSStyleDeclaration.getPropertyCSSValue() +slug: Web/API/CSSStyleDeclaration/getPropertyCSSValue +tags: + - API + - CSSOM + - Method + - Obsolete + - Reference +translation_of: Web/API/CSSStyleDeclaration/getPropertyCSSValue +--- +<p>{{ APIRef("CSSOM") }} {{Obsolete_header}}</p> + +<p><span class="seoSummary"><strong>CSSStyleDeclaration.getPropertyCSSValue()</strong> メソッドインターフェイスは、プロパティの CSS 値を含む {{domxref('CSSValue')}} を返します。</span> プロパティ名が省略プロパティの場合は <code>null</code> を返すことに注意して下さい。</p> + +<p>代わりに {{domxref("CSSStyleDeclaration.getPropertyValue()")}} を使用する必要があります。</p> + +<h2 id="構文">構文</h2> + +<pre class="syntaxbox notranslate">var <em>value</em> = <em>style</em>.getPropertyCSSValue(<em>property</em>);</pre> + +<h3 id="パラメータ">パラメータ</h3> + +<ul> + <li><em><code>property</code></em> は、取得するプロパティ名を表す {{domxref('DOMString')}} です。</li> +</ul> + +<h3 id="返り値">返り値</h3> + +<ul> + <li><code><em>value</em></code> は、プロパティの CSS 値を含む {{domxref('CSSValue')}} です。存在しない場合は <code>null</code> を返します。</li> +</ul> + +<h2 id="例">例</h2> + +<p>次の JavaScript コードは、 <code>color</code> CSS プロパティの計算された RGB 値を含むオブジェクトを取得します:</p> + +<pre class="brush: js notranslate">var style = window.getComputedStyle(elem, null); +var rgbObj = style.getPropertyCSSValue('color').getRGBColorValue(); +</pre> + +<h2 id="仕様">仕様</h2> + +<table> + <thead> + <tr> + <th scope="col">仕様</th> + <th scope="col">ステータス</th> + <th scope="col">備考</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('DOM2 Style', 'css.html#CSS-CSSStyleDeclaration', 'CSSStyleDeclaration')}}</td> + <td>{{Spec2('DOM2 Style')}}</td> + <td><a href="https://lists.w3.org/Archives/Public/www-style/2003Oct/0347.html">2003年7月</a>に廃止と宣言</td> + </tr> + </tbody> +</table> + +<h2 id="ブラウザー実装状況">ブラウザー実装状況</h2> + + + +<p>{{Compat("api.CSSStyleDeclaration.getPropertyCSSValue")}}</p> diff --git a/files/ja/web/api/cssstyledeclaration/getpropertyvalue/index.html b/files/ja/web/api/cssstyledeclaration/getpropertyvalue/index.html new file mode 100644 index 0000000000..feb4705491 --- /dev/null +++ b/files/ja/web/api/cssstyledeclaration/getpropertyvalue/index.html @@ -0,0 +1,67 @@ +--- +title: CSSStyleDeclaration.getPropertyValue() +slug: Web/API/CSSStyleDeclaration/getPropertyValue +tags: + - API + - CSSOM + - Method + - Reference +translation_of: Web/API/CSSStyleDeclaration/getPropertyValue +--- +<p>{{ APIRef("CSSOM") }}</p> + +<p><strong>CSSStyleDeclaration.getPropertyValue()</strong> メソッドインターフェイスは、指定された CSS プロパティの値を含む {{domxref('DOMString')}} を返します。</p> + +<h2 id="構文">構文</h2> + +<pre class="syntaxbox notranslate">var <em>value</em> = <em>style</em>.getPropertyValue(<em>property</em>);</pre> + +<h3 id="パラメータ">パラメータ</h3> + +<ul> + <li><em><code>property</code></em> は、チェックされるプロパティ名を表す {{domxref('DOMString')}} です。</li> +</ul> + +<h3 id="返り値">返り値</h3> + +<ul> + <li><code><em>value</em></code> は、プロパティの値を含む {{domxref('DOMString')}} です。設定されていない場合、空の文字列を返します。</li> +</ul> + +<h2 id="例">例</h2> + +<p>次の JavaScript コードは CSS セレクタールールの <code>margin</code> プロパティの値をクエリします:</p> + +<pre class="brush: js notranslate">var declaration = document.styleSheets[0].cssRules[0].style; +var value = declaration.getPropertyValue('margin'); // "1px 2px" +</pre> + +<h2 id="仕様">仕様</h2> + +<table> + <thead> + <tr> + <th scope="col">仕様</th> + <th scope="col">ステータス</th> + <th scope="col">備考</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('CSSOM', '#dom-cssstyledeclaration-getpropertyvalue', 'CSSStyleDeclaration.getPropertyValue()')}}</td> + <td>{{Spec2('CSSOM')}}</td> + <td></td> + </tr> + <tr> + <td>{{SpecName('DOM2 Style', 'css.html#CSS-CSSStyleDeclaration', 'CSSStyleDeclaration')}}</td> + <td>{{Spec2('DOM2 Style')}}</td> + <td></td> + </tr> + </tbody> +</table> + +<h2 id="ブラウザー実装状況">ブラウザー実装状況</h2> + + + +<p>{{Compat("api.CSSStyleDeclaration.getPropertyValue")}}</p> diff --git a/files/ja/web/api/cssstyledeclaration/index.html b/files/ja/web/api/cssstyledeclaration/index.html new file mode 100644 index 0000000000..7055ef0943 --- /dev/null +++ b/files/ja/web/api/cssstyledeclaration/index.html @@ -0,0 +1,121 @@ +--- +title: CSSStyleDeclaration +slug: Web/API/CSSStyleDeclaration +translation_of: Web/API/CSSStyleDeclaration +--- +<div>{{APIRef("CSSOM")}}</div> + +<p><strong><code>CSSStyleDeclaration</code></strong>インターフェースはCSS宣言ブロックオブジェクトを表し、スタイル情報やスタイル関連のメソッド、プロパティを提供します。</p> + +<p><code>CSSStyleDeclaration</code> オブジェクトは下記の3つのAPIによって使用されます。</p> + +<ul> + <li>{{DOMxRef("HTMLElement.style")}}。<br> + DOM要素をインラインスタイルで扱う際。(例, <code><div style="..."></code>).</li> + <li>{{DOMxRef("CSSStyleSheet")}} API。<br> + 例えば<code>document.styleSheets[0].cssRules[0].style</code> は、<code>CSSStyleDeclaration</code> を返します。</li> + <li>{{DOMxRef("Window.getComputedStyle()")}}。<br> + これは読み取り専用インターフェースとして、<code>CSSStyleDeclaration</code> オブジェクトを返します。</li> +</ul> + +<h2 id="属性">属性</h2> + +<dl> + <dt>{{DOMxRef("CSSStyleDeclaration.cssText")}}</dt> + <dd>Textual representation of the declaration block. Setting this attribute changes the style.<br> + CSSブロック宣言をテキスト表示する。この属性を与えることでスタイルを変化させることが可能。</dd> + <dt>{{DOMxRef("CSSStyleDeclaration.length")}}{{ReadOnlyInline}}</dt> + <dd>プロパティの数を表す。後述の{{DOMxRef("CSSStyleDeclaration.item()", 'item()')}}メソッドを参照のこと。<br> + </dd> + <dt>{{DOMxRef("CSSStyleDeclaration.parentRule")}}{{ReadOnlyInline}}</dt> + <dd>{{DOMxRef("CSSRule")}}を含むコンテナを表す。</dd> +</dl> + +<h3 id="CSS_プロパティ">CSS プロパティ</h3> + +<dl> + <dt>{{DOMxRef("CSSStyleDeclaration.named_properties", "CSSStyleDeclaration.cssFloat")}}</dt> + <dd>{{CSSxRef("float")}} CSSプロパティのエイリアス。</dd> + <dt>{{DOMxRef("CSSStyleDeclaration.named_properties", '<code>CSSStyleDeclaration</code> named properties', "", 1)}}</dt> + <dd>全てのCSSプロパティに対して、その値を取得する。</dd> +</dl> + +<h2 id="メソッド">メソッド</h2> + +<dl> + <dt>{{DOMxRef("CSSStyleDeclaration.getPropertyPriority()")}}</dt> + <dd>Returns the optional priority, "important".</dd> + <dt>{{DOMxRef("CSSStyleDeclaration.getPropertyValue()")}}</dt> + <dd>Returns the property value given a property name.</dd> + <dt>{{DOMxRef("CSSStyleDeclaration.item()")}}</dt> + <dd>Returns a CSS property name by its index, or the empty string if the index is out-of-bounds.</dd> + <dd>An alternative to accessing <code>nodeList[<var>i</var>]</code> (which instead returns <code>undefined</code> when <code><var>i</var></code> is out-of-bounds). This is mostly useful for non-JavaScript DOM implementations.</dd> + <dt>{{DOMxRef("CSSStyleDeclaration.removeProperty()")}}</dt> + <dd>Removes a property from the CSS declaration block.</dd> + <dt>{{DOMxRef("CSSStyleDeclaration.setProperty()")}}</dt> + <dd>Modifies an existing CSS property or creates a new CSS property in the declaration block.</dd> + <dt>{{DOMxRef("CSSStyleDeclaration.getPropertyCSSValue()")}} {{Obsolete_Inline}}</dt> + <dd><strong>Only supported via getComputedStyle in Firefox.</strong> Returns the property value as a {{DOMxRef("CSSPrimitiveValue")}} or <code>null</code> for <a href="/en-US/docs/Web/CSS/Shorthand_properties" title="en/Guide to Shorthand CSS">shorthand properties</a>.</dd> +</dl> + +<h2 id="例">例</h2> + +<pre class="brush: js notranslate">var styleObj = document.styleSheets[0].cssRules[0].style; +console.log(styleObj.cssText); + +for (var i = styleObj.length; i--;) { + var nameString = styleObj[i]; + styleObj.removeProperty(nameString); +} + +console.log(styleObj.cssText);</pre> + +<h2 id="仕様">仕様</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">仕様</th> + <th scope="col">ステータス</th> + <th scope="col">コメント</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('CSSOM', '#the-cssstyledeclaration-interface', 'CSSStyleDeclaration')}}</td> + <td>{{Spec2('CSSOM')}}</td> + <td>Merged the <strong>DOM Level 2 Style</strong> <code>CSS2Properties</code> interface into <code>CSSStyleDeclaration</code>.</td> + </tr> + <tr> + <td>{{SpecName('DOM2 Style', 'css.html#CSS-CSSStyleDeclaration', 'CSSStyleDeclaration')}}</td> + <td>{{Spec2('DOM2 Style')}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="ブラウザー実装状況">ブラウザー実装状況</h2> + + + +<p>{{Compat("api.CSSStyleDeclaration")}}</p> + +<h2 id="関連情報">関連情報</h2> + +<ul> + <li><a href="/en-US/docs/Web/CSS/CSS_Properties_Reference" title="/en-US/docs/Web/CSS/CSS_Properties_Reference">CSS Properties Reference</a></li> +</ul> + +<div class="jfk-bubble gtx-bubble"> +<div class="jfk-bubble-content-id" id="bubble-8"> +<div id="gtx-host" style="max-width: 400px;"></div> +</div> + +<div class="jfk-bubble-closebtn-id jfk-bubble-closebtn"></div> + +<div class="jfk-bubble-arrow-id jfk-bubble-arrow jfk-bubble-arrowup" style="left: 163.5px;"> +<div class="jfk-bubble-arrowimplbefore"></div> + +<div class="jfk-bubble-arrowimplafter"></div> +</div> +</div> |