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>
This commit is contained in:
Oriol Brufau 2025-04-03 08:56:47 -07:00 committed by GitHub
parent 9d6e1f67fb
commit f29c182929
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 57 additions and 309 deletions

View file

@ -1,25 +0,0 @@
[CSSStyleSheet.html]
[addRule with no argument adds "undefined" selector]
expected: FAIL
[removeRule on empty style sheet throws]
expected: FAIL
[cssRules and rules are the same object]
expected: FAIL
[addRule with index greater than length throws]
expected: FAIL
[addRule with #foo selectors]
expected: FAIL
[removeRule(1)]
expected: FAIL
[removeRule with no argument removes first rule]
expected: FAIL
[addRule with @media rule]
expected: FAIL

View file

@ -53,9 +53,6 @@
[SVGStyleElement interface: attribute sheet]
expected: FAIL
[CSSStyleSheet interface: attribute rules]
expected: FAIL
[CSSStyleDeclaration interface: sheet.cssRules[2\].cssRules[0\].style must inherit property "setProperty(CSSOMString, CSSOMString, optional CSSOMString)" with the proper type]
expected: FAIL
@ -101,9 +98,6 @@
[CSSStyleDeclaration interface: svg_element.style must inherit property "cssFloat" with the proper type]
expected: FAIL
[CSSStyleSheet interface: calling addRule(optional DOMString, optional DOMString, optional unsigned long) on sheet with too few arguments must throw TypeError]
expected: FAIL
[CSSStyleDeclaration must be primary interface of sheet.cssRules[2\].cssRules[0\].style]
expected: FAIL
@ -161,9 +155,6 @@
[CSSPageRule interface: existence and properties of interface prototype object's @@unscopables property]
expected: FAIL
[CSSStyleSheet interface: operation addRule(optional DOMString, optional DOMString, optional unsigned long)]
expected: FAIL
[CSSRule interface: sheet.cssRules[1\] must inherit property "parentRule" with the proper type]
expected: FAIL
@ -173,9 +164,6 @@
[CSSPageRule interface: existence and properties of interface object]
expected: FAIL
[CSSStyleSheet interface: sheet must inherit property "rules" with the proper type]
expected: FAIL
[CSSPageRule must be primary interface of sheet.cssRules[2\]]
expected: FAIL
@ -230,9 +218,6 @@
[CSSPageRule interface: sheet.cssRules[2\] must inherit property "selectorText" with the proper type]
expected: FAIL
[CSSStyleSheet interface: sheet must inherit property "addRule(optional DOMString, optional DOMString, optional unsigned long)" with the proper type]
expected: FAIL
[CSSMarginRule interface: existence and properties of interface prototype object's @@unscopables property]
expected: FAIL
@ -284,9 +269,6 @@
[CSSStyleDeclaration interface: sheet.cssRules[2\].style must inherit property "cssText" with the proper type]
expected: FAIL
[CSSStyleSheet interface: operation removeRule(optional unsigned long)]
expected: FAIL
[Stringification of sheet.cssRules[4\]]
expected: FAIL
@ -347,9 +329,6 @@
[CSSRule interface: sheet.cssRules[4\] must inherit property "cssText" with the proper type]
expected: FAIL
[CSSStyleSheet interface: sheet must inherit property "removeRule(optional unsigned long)" with the proper type]
expected: FAIL
[CSSMarginRule interface: existence and properties of interface prototype object's "constructor" property]
expected: FAIL
@ -407,9 +386,6 @@
[CSSMarginRule interface: attribute style]
expected: FAIL
[CSSStyleSheet interface: calling removeRule(optional unsigned long) on sheet with too few arguments must throw TypeError]
expected: FAIL
[CSSStyleDeclaration interface: sheet.cssRules[2\].style must inherit property "getPropertyValue(CSSOMString)" with the proper type]
expected: FAIL

View file

@ -1,6 +1,3 @@
[insertRule-across-context.html]
[The constructor of inserted rule object must be from iframe]
expected: FAIL
[The constructor of inserted rule object must be from iframe for new CSSStyleSheet()]
expected: FAIL