servo/components/script_bindings/webidls/CSSStyleSheet.webidl
Oriol Brufau f29c182929
script: Implement deprecated CSSStyleSheet members (#36313)
Implements `rules`, `addRule()` and `removeRule()` for `CSSStyleSheet`.
https://drafts.csswg.org/cssom/#legacy-css-style-sheet-members

This is part of #36162

Testing:
- `/css/css-cascade/at-scope-parsing.html`
- `/css/css-conditional/at-supports-whitespace.html`
- `/css/css-nesting/invalidation-004.html`
- `/css/css-nesting/parsing.html`
- `/css/css-nesting/serialize-group-rules-with-decls.html`
- `/css/css-syntax/custom-property-rule-ambiguity.html`
- `/css/css-syntax/invalid-nested-rules.html`
- `/css/css-syntax/trailing-braces.html`
- `/css/css-syntax/var-with-blocks.html`
- `/css/css-transitions/parsing/starting-style-parsing.html`
- `/css/cssom/CSSStyleSheet.html`
- `/css/cssom/idlharness.html`
- `/css/cssom/insertRule-across-context.html`

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-04-03 15:56:47 +00:00

23 lines
970 B
Text

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://drafts.csswg.org/cssom/#the-cssstylesheet-interface
[Exposed=Window]
interface CSSStyleSheet : StyleSheet {
// readonly attribute CSSRule? ownerRule;
[Throws, SameObject] readonly attribute CSSRuleList cssRules;
[Throws] unsigned long insertRule(DOMString rule, optional unsigned long index = 0);
[Throws] undefined deleteRule(unsigned long index);
};
// https://drafts.csswg.org/cssom/#legacy-css-style-sheet-members
partial interface CSSStyleSheet {
[Throws, SameObject] readonly attribute CSSRuleList rules;
[Throws] long addRule(
optional DOMString selector = "undefined",
optional DOMString style = "undefined",
optional unsigned long index
);
[Throws] undefined removeRule(optional unsigned long index = 0);
};