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

[cssom] Is the CSSOM ever going to preserve rules? #1858

Closed
matthew-dean opened this issue Oct 10, 2017 · 5 comments
Closed

[cssom] Is the CSSOM ever going to preserve rules? #1858

matthew-dean opened this issue Oct 10, 2017 · 5 comments
Labels
cssom-1 Current Work

Comments

@matthew-dean
Copy link

Currently, browsers are instructed to discard unknown style rules. It would be great if this would change and browsers would be required to keep the rules, but flag them as unknown and not applied. This would allow a lot of style-related polyfilling in the browser (Less- or Sass-like behaviour).

Is this on the radar anywhere?

@matthew-dean
Copy link
Author

I assume this is the related spec? https://drafts.css-houdini.org/css-properties-values-api/

@frivoal
Copy link
Collaborator

frivoal commented Oct 11, 2017

That is somewhat related, as the houdini project is all about exposing lower level primitives to let authors do things the browser don't, but I do not think this particular specification alone will fulfill your goals for this topic.

On the other hand, have a look here: https://github.com/WICG/CSS-Parser-API

@tabatkins tabatkins added the cssom-1 Current Work label Oct 11, 2017
@tabatkins
Copy link
Member

This isn't going to happen, and fairly intentionally - if we kept around invalid/unrecognized stuff and made it easy for JS to fill in the functionality, then it would be really easy for pages to "squat" on names, making it harder for us to change or add new CSS in the future. This sort of thing is an occasional problem in JS already.

Instead, CSS is growing more robust custom-whatever functionality in the Houdini WG; custom properties are the start, and we'll move toward custom functions, custom at-rules, and others in the future. These all live in a different namespace (due to the -- prefix) which normal CSS will never use, so it's safe to use whatever names you want there.

As Florian said, we will be adding an explicit parser API that lets you re-use the general CSS syntax for other things, and that will let you manually reparse a stylesheet's text and see what all is in there without having "invalid" things thrown away, but it's a sufficient barrier to usage that it probably won't harm CSS's future evolution in the way I described above.

@matthew-dean
Copy link
Author

Thanks @tabatkins. Is there a timeline for when the Houdini stuff / parser API might be happening?

@tabatkins
Copy link
Member

Some parts are happening right now, and showing up experimentally in browsers, like Custom Paint and Custom Layout. The Parser API is going to end up an extension of the Typed OM spec, which is also being developed/implemented right now.

Further custom constructs (functions, at-rules) are waiting for TypedOM/parser implementation and experience before we push forward with them, as they depend on that tech.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cssom-1 Current Work
Projects
None yet
Development

No branches or pull requests

3 participants