- From: CSS Meeting Bot via GitHub <sysbot+gh@w3.org>
- Date: Wed, 04 Oct 2023 23:16:10 +0000
- To: public-css-archive@w3.org
The CSS Working Group just discussed `[css-syntax] Dashed-ident rules and error recovery`, and agreed to the following: * `ACTION: TabAtkins to look into using a more generic term than 'nested' for the flag for mixed declaration+rule contexts` * `RESOLVED: at top level, if you see a rule that looks like a custom property, we consume as a rule and throw it away as invalid` <details><summary>The full IRC log of that discussion</summary> <TabAtkins> scribe+ TabAtkins<br> <fantasai> TabAtkins: We resolved the fundamental grammar ambiguity between properties and declarations in nesting by deciding we would start by parsing as a declaration, and if it was invalid, go backand parse as a rule<br> <fantasai> TabAtkins: recently tweaked to make more efficient<br> <fantasai> TabAtkins: works pretty fine, but a wrinkle about custom properties<br> <fantasai> TabAtkins: custom properties are very hard to make invalid<br> <fantasai> TabAtkins: anything you write in a custom property will always be valid<br> <fantasai> TabAtkins: so if you write --foo: [anything] that's a valid custom property<br> <fantasai> TabAtkins: in order to avoid a behavior change for authors<br> <fantasai> TabAtkins: if it looks like custom property, we treat it as a custom property during rule parsing<br> <fantasai> TabAtkins: if you have 'display:hover', can quickly tell it's not a valid display<br> <fantasai> TabAtkins: issue is that I didn't condition that check on being in a nested context<br> <fantasai> TabAtkins: so as written, if you have a top-level style rule starting with --foo:whatever, it will try to consume a custom property declaration<br> <fantasai> TabAtkins: it will eat everything up to the next top-level semicolon<br> <fantasai> TabAtkins: lose the rest of the stylesheet from that point forward<br> <fantasai> TabAtkins: I didn't think about this case, so proposal is to condition that check for "does this look like a custom property" to check whether in a nested context or not<br> <fantasai> TabAtkins: if not nested context, we let it parse as a rule<br> <fantasai> TabAtkins: but will do rule-parsing and end at next curly brace<br> <fantasai> TabAtkins: this means that behavior-wise, this brings us back to how this case would have acted before my recent change to allow nesting to work<br> <fantasai> TabAtkins: i.e. if you write a style rule --foo:whatever, it will only eat one style rule<br> <fantasai> TabAtkins: I've checked this with Emilio during TPAC<br> <astearns> q+<br> <astearns> ack fantasai<br> <TabAtkins> fantasai: so what this means is that parsing behavior for style rules with a custom ident is different in top level vs nested<br> <TabAtkins> fantasai: so if we have custom idents at beginnign of selector, will we be int rouble?<br> <fantasai> TabAtkins: In both cases, if you try to write a rule with --foo:something, you would end up with something invalid<br> <fantasai> TabAtkins: if it wasn't a valid custom property, you won't get a rule<br> <fantasai> TabAtkins: The difference in parsing behavior is, if it's nested it'll consume as a declaration<br> <fantasai> TabAtkins: whereas at top level it'll consume as a rule<br> <fantasai> TabAtkins: in both cases, can't be a rule<br> <fantasai> TabAtkins: we took as an implicit restriction on ourselves that if you have a style rule that wants to start with a dashed type selector, you have to spell it differently e.g. wrap in :is()<br> <fantasai> TabAtkins: considered that to be fine because that's not a valid custom element name in HTML or XML (I think?)<br> <fantasai> TabAtkins: very difficult to have a type selector that looks like that, can work around<br> <fantasai> TabAtkins: error recovery is different in both cases, but either way the rule is invalid and won't work<br> <fantasai> TabAtkins: and I think that's enough consistency<br> <fantasai> ok, sgtm<br> <fantasai> astearns: My qeustion is, defining it as working normally in nested context vs defining it as doing different thing in top-level<br> <fantasai> astearns: would that be exactly the same? I'm worried nested context are about CSS nesting, not a regular declaration block...<br> <fantasai> TabAtkins: the switch used in Syntax is "is it mixed with declarations"<br> <fantasai> astearns: ok, and nested context is that type of context<br> <fantasai> TabAtkins: yeah<br> <fantasai> TabAtkins: flag is called "nested" but in practice used for mixed cases<br> <fantasai> astearns: might want a different term<br> <fantasai> TabAtkins: I'll look into it<br> <fantasai> ACTION: TabAtkins to look into using a more generic term than 'nested' for the flag for mixed declaration+rule contexts<br> <fantasai> TabAtkins: Proposal is, at top level, if you see a rule that looks like a custom property, we consume as a rule and throw it away as invalid<br> <fantasai> RESOLVED: at top level, if you see a rule that looks like a custom property, we consume as a rule and throw it away as invalid<br> </details> -- GitHub Notification of comment by css-meeting-bot Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9336#issuecomment-1747773800 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 4 October 2023 23:16:12 UTC