StyleSheet: parentStyleSheet 属性
StyleSheet
接口的 parentStyleSheet
属性返回包含给定样式表的样式表(如果有)。
值
一个 StyleSheet
对象。
示例
js
// Find the top level stylesheet
const sheet = stylesheet.parentStyleSheet ?? stylesheet;
注意
如果当前样式表是顶级样式表,或者不支持样式表包含,则此属性返回 null
。
规范
规范 |
---|
CSS 对象模型 (CSSOM) # dom-stylesheet-parentstylesheet |
浏览器兼容性
加载中…