Open
Description
https://w3c.github.io/csswg-drafts/css-nesting/#cssom-style
I think this would be nicer as
partial interface CSSStyleRule {
attribute ObservableArray<CSSRule> cssRules;
};
This:
- Ensures that
cssRules
has all the niceArray
methods, e.g.map()
,filter()
, etc. - Removes the confusing
item()
method. - Allows manipulating the CSS rules using normal array methods, e.g.
rule.cssRules.pop()
,rule.cssRules.splice(4, 1)
, etc. - Allows completing replacing the rules list, e.g.
rule.cssRules = [newRule1, newRule2]
.
You could optionally keep insertRule()
and deleteRule()
, but they would probably be less necessary. (Although I guess there's no other way to go from string -> CSSRule
?)
/cc @tabatkins as someone interested in array-like design on the web platform.