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/zh-cn/web/api/document/stylesheetsets | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/document/stylesheetsets')
-rw-r--r-- | files/zh-cn/web/api/document/stylesheetsets/index.html | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/document/stylesheetsets/index.html b/files/zh-cn/web/api/document/stylesheetsets/index.html new file mode 100644 index 0000000000..329884f55c --- /dev/null +++ b/files/zh-cn/web/api/document/stylesheetsets/index.html @@ -0,0 +1,54 @@ +--- +title: Document.styleSheetSets +slug: Web/API/Document/styleSheetSets +tags: + - Document.styleSheetSets +translation_of: Web/API/Document/styleSheetSets +--- +<div>{{APIRef("DOM")}}{{gecko_minversion_header("1.9")}}</div> + +<p>返回一个所有当前可用样式表集的实时列表。</p> + +<h2 id="Syntax" name="Syntax">Syntax</h2> + +<pre class="syntaxbox"><em>sets</em> = document.styleSheetSets +</pre> + +<p>在返回时,sets 是一个可用的样式表集的列表。</p> + +<h2 id="Example" name="Example">Example</h2> + +<p>Given an {{HTMLElement("ul")}} (list) element with the ID "sheetList", you can populate it with the names of all the available style sheet sets with code like this:</p> + +<pre class="brush:js">var list = document.getElementById("sheetList"); +var sheets = document.styleSheetSets; + +list.innerHTML = ""; + +for (var i = 0; i < sheets.length; i++) { + var item = document.createElement("li"); + + item.innerHTML = sheets[i]; + list.appendChild(item); +}</pre> + +<h2 id="Notes">Notes</h2> + +<p>The list of available style sheet sets is constructed by enumerating all the style sheets available for the document, in the order in which they're listed in the {{domxref("document.styleSheets")}} attribute, adding the <code>title</code> of each style sheet that has a title to the list. Duplicates are dropped from the list (using a case-sensitive comparison).</p> + +<h2 id="Specification" name="Specification">Specifications</h2> + +<ul> + <li><a href="http://www.whatwg.org/specs/web-apps/current-work/#alternate-style-sheets" title="http://www.whatwg.org/specs/web-apps/current-work/#alternate-style-sheets">HTML5: Alternate Style Sheets</a></li> +</ul> + +<h2 id="See_also" name="See_also">See also</h2> + +<ul> + <li>{{domxref("Stylesheet")}}</li> + <li>{{domxref("document.styleSheets")}}</li> + <li>{{domxref("document.lastStyleSheetSet")}}</li> + <li>{{domxref("document.preferredStyleSheetSet")}}</li> + <li>{{domxref("document.selectedStyleSheetSet")}}</li> + <li>{{domxref("document.enableStyleSheetsForSet()")}}</li> +</ul> |