StyleSheet:parentStyleSheet 属性
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
StyleSheet
接口的 parentStyleSheet
属性返回样式表(如果有),其中包含给定的样式表。
值
一个 StyleSheet
对象。
示例
js
// 查找顶级样式表
const sheet = stylesheet.parentStyleSheet ?? stylesheet;
备注
如果当前样式表是一个顶级的样式表或者如果不支持包含样式表,则这个属性返回 null
。
Specifications
Specification |
---|
CSS Object Model (CSSOM)> # dom-stylesheet-parentstylesheet> |
Browser compatibility
Loading…