Re: [csswg-drafts] [css-nesting-1] Syntax Invites Errors (#7834)

> The spec is now updated to Option 3, after a quick hack session with @argyleink; we haven't touched the CSSOM section yet, but the syntax stuff is all done (both in Nesting and in Syntax).

Blink changes are also in review, although they've been done independently, so I'll need to check whether I diverged from the spec at some point. There seems to be still some issues to file to get the interpretation of e.g. :is() 100% nailed down.

> Re: serialization of selectors, we shouldn't do any magical insertion or dropping of stuff. The spec defines how to interpret selectors, but there's no need to "normalize" them to any particular form.

This feels odd. We're already normalizing selectors; in particular, for whitespace. Also, of course we (implementors) need to do magical insertion of stuff; that's the only way we can understand what these nested selectors mean and match against them. If `& > .a` and `> .a` were to serialize differently, we would probably still store the &, but have some sort of “this & was added implicitly” bit solely for the point of serialization. Which feels a bit pointless, but isn't difficult per se (we already do it for relative selectors).

I guess maybe we're coming from different sides here; I see the spec talks about everything being relative selectors now, except that sometimes they're not (and you don't know until after you're done parsing them). I don't intuitively interpret “.foo” standalone as a relative selector, and I think losing the “interpret & as :is(…parent list…)” is a bit sad (the new text just says “any relative selectors are relative to the elements represented by the nesting selector”, which sort of makes the :is() equivalence a secret and its specificity less than obvious?). But if you _do_ define most of those selectors as relative, I understand that you wouldn't want to convert them on serialization.

-- 
GitHub Notification of comment by sesse
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7834#issuecomment-1294064507 using your GitHub account


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

Received on Thursday, 27 October 2022 21:09:44 UTC