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-1] CSSStyleSheet.replace[Sync]() should parse rules according to CSS specs #6995

Closed
cdoublev opened this issue Jan 27, 2022 · 1 comment
Labels

Comments

@cdoublev
Copy link
Collaborator

I believe that CSSStyleSheet.replace() and CSSStyleSheet.replaceSync() are missing a step to parse the input rules according to the appropriate CSS specifications, similarly as in parse a CSS rule, run by insert a CSS rule, run by CSSStyleSheet.insertRule(). Currently, it only parses against basic syntax rules with parse a list of rules, which would mean that something like @namespace "ns" { color: red } should be added to the CSS rules, which is something that UAs are not doing, obviously.

  1. Let rules be the result of running parse a list of rules from text. If rules is not a list of rules (i.e. an error occurred during parsing), set rules to an empty list.
  2. If rules contains one or more @import rules, remove those rules from rules.
  3. Set sheet’s CSS rules to rules.

https://drafts.csswg.org/cssom/#dom-cssstylesheet-replace
https://drafts.csswg.org/cssom/#synchronously-replace-the-rules-of-a-cssstylesheet

@cdoublev
Copy link
Collaborator Author

cdoublev commented Feb 5, 2024

Parse a stylesheet now returns valid rules in the context (see 6ab5888).

@cdoublev cdoublev closed this as completed Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants