Document.lastStyleSheetSet

已废弃
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

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

语法

var lastStyleSheetSet = document.lastStyleSheetSet

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

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

示例

let lastSheetSet = document.lastStyleSheetSet;

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

浏览器兼容性

BCD tables only load in the browser

相关链接