Document.lastStyleSheetSet

已弃用: 不再推荐使用该特性。虽然一些浏览器仍然支持它,但也许已从相关的 web 标准中移除,也许正准备移除或出于兼容性而保留。请尽量不要使用该特性,并更新现有的代码;参见本页面底部的兼容性表格以指导你作出决定。请注意,该特性随时可能无法正常工作。

Document.lastStyleSheetSet 返回最后一个启用的样式表集合。当 document.selectedStyleSheetSet 属性发生变化时,这个属性的值就会随之发生变化。

返回时,lastStyleSheetSet 指示最近设置的样式表。如果当前样式表集尚未通过设置更改 document.selectedStyleSheetSet, 则返回值为 null

备注:document.enableStyleSheetsForSet() 被执行时,该值不会该变。

示例

js
let lastSheetSet = document.lastStyleSheetSet;

if (!lastSheetSet) {
  lastSheetSet = "Style sheet not yet changed";
} else {
  console.log("The last style sheet set is: " + lastSheetSet);
}

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
lastStyleSheetSet
DeprecatedNon-standard

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Non-standard. Check cross-browser support before using.
Deprecated. Not for use in new websites.

参见