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 September 2015.
StyleSheet
接口的 parentStyleSheet
属性返回样式表(如果有),其中包含给定的样式表。
值
一个 StyleSheet
对象。
示例
js
// 查找顶级样式表
const sheet = stylesheet.parentStyleSheet ?? stylesheet;
备注
如果当前样式表是一个顶级的样式表或者如果不支持包含样式表,则这个属性返回 null
。
Specifications
Specification |
---|
CSS Object Model (CSSOM) # dom-stylesheet-parentstylesheet |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
parentStyleSheet |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.