Re: [csswg-drafts] [cssom] Should font descriptors and such appear as properties in CSSStyleDeclaration? (#3647)

I don't think we should keep `CSSStyleDeclaration style` in `CSSFontFaceRule`. This is a mistake.

IIRC, previously when CSS Fonts spec initially introduced this interface, `CSSStyleDeclaration` only contains the methods, and at that time all the property accessors were defined in a separate interface, probably `CSS2Properties`? In that model, it probably makes some sense to use `CSSStyleDeclaration` with a separate set of descriptors. Later, some changes to CSSOM spec merges the aforementioned two interfaces, and consequently `CSSFontFaceRule.style` incorrect gains all the properties in the perspective of the spec, which makes no sense.

Gecko still has separate `CSSStyleDeclaration` and `CSS2Properties` mainly because of this problem.

Given that I haven't heard any webcompat report regarding Gecko's current behavior on this, I pretty much believe we can move away from this weirdness. I propose that we define a separate interface for `CSSFontFaceRule`, probably something like `CSSFontFaceDeclaration`, and put all font-face descriptors into that interface, then we also copy all the methods from `CSSStyleDeclaration` into the new interface for backward compatibility.

I don't propose creating a common interface for `CSSStyleDeclaration` and `CSSFontFaceDeclaration` to inherit from because I think those methods should be considered legacy, as well as this style of declaring interface for at-rule (i.e. having an indirection `style` property just to access its content). Any new at-rule with descriptors should follow `CSSCounterStyleRule` to have all descriptors listed on the top level.

-- 
GitHub Notification of comment by upsuper
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3647#issuecomment-463592759 using your GitHub account

Received on Thursday, 14 February 2019 11:25:47 UTC