From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../web/api/document/stylesheetsets/index.html | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 files/zh-cn/web/api/document/stylesheetsets/index.html (limited to 'files/zh-cn/web/api/document/stylesheetsets') 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 +--- +
{{APIRef("DOM")}}{{gecko_minversion_header("1.9")}}
+ +

返回一个所有当前可用样式表集的实时列表。

+ +

Syntax

+ +
sets = document.styleSheetSets
+
+ +

在返回时,sets 是一个可用的样式表集的列表。

+ +

Example

+ +

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:

+ +
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);
+}
+ +

Notes

+ +

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 title of each style sheet that has a title to the list. Duplicates are dropped from the list (using a case-sensitive comparison).

+ +

Specifications

+ + + +

See also

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