Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate partial interface CSSStyleDeclaration from known CSS properties #119

Closed
foolip opened this issue Aug 14, 2018 · 3 comments
Closed

Comments

@foolip
Copy link
Member

foolip commented Aug 14, 2018

https://drafts.csswg.org/cssom/#the-cssstyledeclaration-interface has some IDL "macros":

partial interface CSSStyleDeclaration {
  [CEReactions] attribute [TreatNullAs=EmptyString] CSSOMString _camel_cased_attribute;
};
partial interface CSSStyleDeclaration {
  [CEReactions] attribute [TreatNullAs=EmptyString] CSSOMString _webkit_cased_attribute;
};
partial interface CSSStyleDeclaration {
  [CEReactions] attribute [TreatNullAs=EmptyString] CSSOMString _dashed_attribute;
};

These should be turned into something like this:

partial interface CSSStyleDeclaration {
  [CEReactions] attribute [TreatNullAs=EmptyString] CSSOMString display;
  [CEReactions] attribute [TreatNullAs=EmptyString] CSSOMString align-content;
};

Gecko actually does generate IDL as part of the build step:
https://github.com/mozilla/gecko-dev/blob/86897859913403b68829dbf9a154f5a87c4b0638/dom/webidl/CSS2Properties.webidl.in

So, it would be great if reffy could output a cssom-generated.idl based on the properties found in all other specs, which could then be used in an idlharness.js test. Using something like the above snippet with display and align-content, I know that Chrome and Safari will fail all tests, Firefox fail the prototype ones (because it has CSS2Properties instead) and Edge pass except for dashed attributes.

I'll have a go at generating that IDL.

@foolip
Copy link
Member Author

foolip commented Aug 20, 2018

This would build on #113, which is already working.

@tidoust @lukebjerring, there are a number of options for when to generate the IDL and I'm wondering if you have preferences:

I'm leaning towards the last option, and the main problem I see is how to ensure that all the specs that define properties actually are tested like this. Even if we did a single css/cssom/interfaces-generated.html test, that test would still have to list all the JSON files to load and check.

@tidoust
Copy link
Member

tidoust commented Aug 21, 2018

I don't feel strongly but I'd prefer the last option as well. Although Reffy runs some analyses on the content it extracts, the dumps were meant to stay as close to the actual IDL (or meta-IDL) defined in the spec as possible, so that other tools can run on them with confidence that what they are seeing is what the spec defines.

@tidoust
Copy link
Member

tidoust commented Jun 2, 2021

Reffy now generates a styleDeclaration property for CSS properties as discussed in w3c/webref#51. This approach was preferred to generating the partial interface definitions (which can easily be done with this new property).

@tidoust tidoust closed this as completed Jun 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants