blob: 329884f55ccdccf7a9660d6c5196d6329332891e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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>
|