- From: Guillaume via GitHub <sysbot+gh@w3.org>
- Date: Tue, 18 Apr 2023 12:03:02 +0000
- To: public-css-archive@w3.org
Actually I do not see how it makes it less complex for engines. An author could write this style sheet: ```css @layer base; @namespace ns "https://ns.org"; ``` But it could not construct the corresponding style sheet? ```js const sheet = new CSSStyleSheet() sheet.insertRule('@layer base;') sheet.insertRule('@namespace ns "https://ns.org";', 1) // InvalidStateError ``` It seems to boil down to sharing the same validation function... ```js function isInvalidStateForNamespaceRule(rule, rules) { return rules.some(isNotImportOrNamespaceOrLayerStatementRule) } function parseStyleSheet(rules) { const valid = [] for (const rule of rules) { if (isNamespace(Rule) && isInvalidStateForNamespaceRule(rule, valid)) { continue } // ... valid.push(rule) } return rules.filter(rule => ) } function insertCSSRule(rule, context) { // ... // Nope, CSSOM requires a different validation here! if (isNamespace(Rule) && isInvalidStateForNamespaceRule(rule, context)) { throw InvalidStateError } // ... } ``` -- GitHub Notification of comment by cdoublev Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8654#issuecomment-1512966145 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 18 April 2023 12:03:04 UTC