[csswg-drafts] [cssom-1] `CSSStyleSheet.replace[Sync]()` should parse rules according to CSS specs (#6995)

cdoublev has just created a new issue for https://github.com/w3c/csswg-drafts:

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

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6995 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 27 January 2022 09:24:41 UTC