script: Implement CSSStyleSheet constructor (#36521)

https://drafts.csswg.org/cssom/#dom-cssstylesheet-cssstylesheet

Testing: covered by WPT
This is part of #36162

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2025-04-15 07:05:13 -07:00 committed by GitHub
parent 372fd04b23
commit 10f6f50c61
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 127 additions and 38 deletions

View file

@ -5,12 +5,20 @@
// https://drafts.csswg.org/cssom/#the-cssstylesheet-interface
[Exposed=Window]
interface CSSStyleSheet : StyleSheet {
constructor(optional CSSStyleSheetInit options = {});
// 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);
};
dictionary CSSStyleSheetInit {
// DOMString baseURL = null;
(MediaList or DOMString) media;
boolean disabled = false;
};
// https://drafts.csswg.org/cssom/#legacy-css-style-sheet-members
partial interface CSSStyleSheet {
[Throws, SameObject] readonly attribute CSSRuleList rules;