web api interface
CSSScopeRule
The CSSScopeRule interface of the CSS Object Model represents a CSS @scope at-rule.
Instance properties
Inherits properties from its ancestors CSSGroupingRule and CSSRule.
end- : Returns a string containing the value of the
@scopeat-rule’s scope limit.
- : Returns a string containing the value of the
start- : Returns a string containing the value of the
@scopeat-rule’s scope root.
- : Returns a string containing the value of the
Instance methods
Inherits methods from its ancestors CSSGroupingRule and CSSRule.
Examples
Accessing @scope information in JavaScript
Assuming the following is the only stylesheet attached to a document:
@scope (.outer) to (.inner) {
:scope {
background: yellow;
}
}
The following JavaScript could be used to access information about the contained @scope block:
const scopeBlock = document.styleSheets[0].cssRules[0];
console.log(scopeBlock.start); // Returns ".outer"
console.log(scopeBlock.end); // Returns ".inner"
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.