Re: [csswg-drafts] [css-shadow-parts] are rules for which pseudo-classes and pseudo-elements work after ::part() parse-time or match-time? (#10786)

The CSS Working Group just discussed `[css-shadow-parts] are rules for which pseudo-classes and pseudo-elements work after ::part() parse-time or match-time?`, and agreed to the following:

* `RESOLVED: reject these invalid selectors at parse time`

<details><summary>The full IRC log of that discussion</summary>
&lt;dholbert> dbaron: I filed a series of pseudo-element issues. this first one was a case where spec was written after impls/tests were written<br>
&lt;dholbert> dbaron: impls are interoperable and disagree with spec<br>
&lt;dholbert> dbaron: spec says some pseudo elements / classes work after ::part<br>
&lt;dholbert> dbaron: but all of them are supposed to be syntactically allowed at parse time, and the ones that don't work just don't match<br>
&lt;dholbert> dbaron: but impls reject at parse time the ones that don't work<br>
&lt;dholbert> dbaron: TabAtkins prefers what the spec says<br>
&lt;dholbert> dbaron: TabAtkins thinks parse-time selector restrictions haven't been very successful and we shouldn't add more of them<br>
&lt;TabAtkins> +1<br>
&lt;dholbert> dbaron: counterargument: it's already implemented across 3 engines, so changing impls might have some level of risk<br>
&lt;keithamus> q+<br>
&lt;dholbert> dbaron: Also, it's more consistent with other pseudo-elements<br>
&lt;florian> q+<br>
&lt;dholbert> dbaron: other pseudos that don't do anything are invalid at parse time<br>
&lt;emilio> q+<br>
&lt;dholbert> dbaron: [gives an example with two ::before elements]<br>
&lt;dholbert> dbaron: my inclination is to do easy thing and change spec to match the impls + tests<br>
&lt;lea> q+ to ask, it sounds like there's a clear upside to doing the validation at match time. What's the downside?<br>
&lt;dholbert> dbaron: this is widely tested in WPTs. We could just change the spec and say we've got it already implemented and tested<br>
&lt;kbabbitt> s/two ::before elements/::before::before selector, which is invalid/<br>
&lt;dholbert> dbaron: I'd like us to do that, or to hear a convincing argument in the other direction<br>
&lt;Rossen6> ack keithamus<br>
&lt;dholbert> ???:  another benefit is that impls can highlight this in devtools<br>
&lt;lea> We can address that head-on by providing a method to test whether selectors are valid<br>
&lt;dbaron> s/???/keithamus/<br>
&lt;dholbert> keithamus: that's another argument for the parse-time restriction<br>
&lt;Rossen6> ack florian<br>
&lt;dholbert> florian: people who put tests in WPTs are welcome to change the spec &amp; file spec bugs<br>
&lt;dholbert> florian: we should generally be more careful about this<br>
&lt;dholbert> dbaron: in this particular case, the tests were mostly testing other things. They were testing the rules for what wasn't allowed, and they didn't realize that there was stuff about it being a parse-time restriction<br>
&lt;dholbert> florian: there's a significant difference between things that are currently invalid are strongly expected to stay invalid forever, vs. if it may someday change<br>
&lt;dholbert> florian: if we treat a selector as a parse-time error and we want to make it valid in the future, that'll be painful<br>
&lt;dholbert> florian: But if we know these are going to be invalid forever, I have an easier time agreeing with your position<br>
&lt;Rossen6> ack emilio<br>
&lt;dholbert> emilio: I think parse-time is generally better; it works better with @supports<br>
&lt;dholbert> emilio: (and CSS.supports, etc)<br>
&lt;astearns> +1 to emilio and keithamus<br>
&lt;dholbert> emilio: I was going to also argue that impl-wise it's better not to have to deal with sort-of valid states, but we have to deal with that with nesting anyways<br>
&lt;dholbert> emilio: but yeah, @supports makes parse-time checking very valuable<br>
&lt;dholbert> emilio: if you want match-time restriction, you can use :is or :where<br>
&lt;dholbert> emilio: given we have a way of doing both things, I lean towards fixing the spec to match reality<br>
&lt;dholbert> florian: I'd be more ??? if we had selector invalidation at each ??? [agreeing I think]<br>
&lt;dholbert> dbaron: given the later issues I want to discuss, there might be a few strange cases of restrictions where we want to relax in the future<br>
&lt;dholbert> dbaron: but in most cases the restrictions are solid because it just doesn't make sense<br>
&lt;dholbert> lea: it sounds like there are upsides &amp; downsides<br>
&lt;Rossen6> ack lea<br>
&lt;Zakim> lea, you wanted to ask, it sounds like there's a clear upside to doing the validation at match time. What's the downside?<br>
&lt;florian> s/I'd be more ???/I'd be more comfortable with the proposal<br>
&lt;dholbert> lea: sounds like arguments for parse-time checking are for testing if something's supported<br>
&lt;kbabbitt> q+<br>
&lt;dholbert> lea: is there a way we could add a way to check for if something is valid that would account for this case, and if we can, are there remaining arguments?<br>
&lt;florian> s/ if we had selector invalidation at each ???/ if we had selector error recovery at each comma, but especially given the availability of :is and :where, I think that's fine.<br>
&lt;Rossen6> ack kbabbitt<br>
&lt;dholbert> kbabbitt: does document.querySelector throw on an invalid selector, and that could be used to check for validity?<br>
&lt;dholbert> lea: only throws at parse time<br>
&lt;dholbert> lea: all our tools right now check for validity at parse-time<br>
&lt;dholbert> kbabbitt: you're looking for a way to check whether a selector that's valid at parse time is valid when used?<br>
&lt;dholbert> lea: sort of, yes<br>
&lt;dholbert> dbaron: we just listed 3 different ways for checking whether selectors are valid, and they're all the parse-time version<br>
&lt;dholbert> dbaron: it'd be confusing to add another way that checks at a different time<br>
&lt;dholbert> lea: who was arguing for making it invalid at match time?<br>
&lt;dholbert> [various]: Tab<br>
&lt;dholbert> dbaron: TabAtkins is OK either way but would prefer match time<br>
&lt;dholbert> Rossen6: we're leaning towards fixing the spec &amp; going with parse time<br>
&lt;Rossen6> q?<br>
&lt;dholbert> Rossen6: objections?<br>
&lt;dholbert> RESOLVED: reject these invalid selectors at parse time<br>
&lt;dholbert> (fixing the spec to match reality)<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10786#issuecomment-2380205005 using your GitHub account


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

Received on Friday, 27 September 2024 22:14:14 UTC