aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/stylesheetlist
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/ja/web/api/stylesheetlist
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/ja/web/api/stylesheetlist')
-rw-r--r--files/ja/web/api/stylesheetlist/index.html63
1 files changed, 63 insertions, 0 deletions
diff --git a/files/ja/web/api/stylesheetlist/index.html b/files/ja/web/api/stylesheetlist/index.html
new file mode 100644
index 0000000000..725f968a59
--- /dev/null
+++ b/files/ja/web/api/stylesheetlist/index.html
@@ -0,0 +1,63 @@
+---
+title: StyleSheetList
+slug: Web/API/StyleSheetList
+tags:
+ - API
+ - CSSOM
+ - NeedsContent
+ - NeedsUpdate
+translation_of: Web/API/StyleSheetList
+---
+<div>{{APIRef("CSSOM")}}</div>
+
+<p><code>StyleSheetList</code> インターフェイスは {{domxref("StyleSheet")}} のリストを表します。</p>
+
+<p>これは配列風のオブジェクトですが、 {{jsxref("Array")}} のメソッドを適用しての反復処理はできません。しかし標準の {{jsxref("Statements/for", "for")}} ループと添字による反復処理、もしくは {{jsxref("Array")}} への変換ができます。</p>
+
+<h2 id="Example" name="Example">例</h2>
+
+<h3 id="Get_document_styleSheet_objects_with_for_loop" name="Get_document_styleSheet_objects_with_for_loop">for ループを使用して document の <a href="/ja/docs/Web/API/CSSStyleSheet">styleSheet</a> オブジェクトを取得</h3>
+
+<pre class="brush: js">for (let i = 0; i &lt; document.styleSheets.length; i++) {
+ let styleSheet = document.styleSheets[i];
+}</pre>
+
+<h3 id="Get_all_CSS_rules_for_the_document_using_Array_methods" name="Get_all_CSS_rules_for_the_document_using_Array_methods">Array のメソッドを適用してすべての CSS ルールを取得</h3>
+
+<pre>const allCSS = [...document.styleSheets]
+ .map(styleSheet =&gt; {
+ try {
+ return [...styleSheet.cssRules]
+ .map(rule =&gt; rule.cssText)
+ .join('');
+ } catch (e) {
+ console.log('Access to stylesheet %s is denied. Ignoring...', styleSheet.href);
+ }
+ })
+ .filter(Boolean)
+ .join('\n');</pre>
+
+<h2 id="Specifications" name="Specifications">仕様書</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th>仕様書</th>
+ <th>状態</th>
+ <th>備考</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName("CSSOM", "#the-stylesheetlist-interface", 'CSSStyleSheetList')}}</td>
+ <td>{{Spec2("CSSOM")}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>
+
+<div class="hidden">このページの互換性一覧表は構造化データから生成されています。データに協力していただけるのであれば、 <a class="external" href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> をチェックアウトしてプルリクエストを送信してください。</div>
+
+<p>{{Compat("api.StyleSheetList")}}</p>