Re: [csswg-drafts] [css-selectors-4] CSS reflection of HTML parsing state (#12578)

The CSS Working Group just discussed `[css-selectors-4] CSS reflection of HTML parsing state`.

<details><summary>The full IRC log of that discussion</summary>
&lt;TabAtkins> noamr: this is part of making navigation smoother and more declarative, rather than with manual JS<br>
&lt;TabAtkins> noamr: specifically, streaming navigation and same-doc navigation<br>
&lt;TabAtkins> noamr: part of that is desire to expose better states of the parser<br>
&lt;TabAtkins> noamr: in this case, it's about elements that are opened but not yet done parsing<br>
&lt;TabAtkins> noamr: while you're streaming html, you might open an &lt;article> with a lot of text, it's starting to display but there's still content streaming in<br>
&lt;TabAtkins> noamr: some issues in the past with wanting an element to only appear when it's done, or have some indication<br>
&lt;TabAtkins> noamr: this is a very specific thing in the html parser spec<br>
&lt;emilio> q+<br>
&lt;TabAtkins> noamr: so the idea's pretty simple, a pseudo-class for whether an element is still open<br>
&lt;astearns> ack fantasai<br>
&lt;Zakim> fantasai, you wanted to ask if this should be distict from whether stuff is loaded<br>
&lt;TabAtkins> fantasai: are the use-cases different from those for querying an elemetn is loaded?<br>
&lt;TabAtkins> noamr: like an image?<br>
&lt;TabAtkins> fantasai: any element, you want parsed and all its resources loaded<br>
&lt;TabAtkins> fantasai: do you want a query distinct from that? parsed and not yet loaded?<br>
&lt;TabAtkins> noamr: a lot of things can be parsed and dont' have laoded resources<br>
&lt;TabAtkins> fantasai: yeah, those'll be done loading immediately<br>
&lt;TabAtkins> fantasai: but for something that has loaded stuff, do you need to distinguish?<br>
&lt;TabAtkins> noamr: unsure. it's a level of granularity down. don't mind starting from something a little more general like :loaded<br>
&lt;TabAtkins> noamr: and then taking it down if needed<br>
&lt;TabAtkins> noamr: if you think aobut containers, or things parsed in a chunked way, often the sub resources arne't loaded, lots of child elements<br>
&lt;TabAtkins> noamr: does "loaded" mean all the hcildren are loaded?<br>
&lt;TabAtkins> fantasai: is that what you want?<br>
&lt;TabAtkins> fantasai: specifically, what's the use-case you're trying to solve<br>
&lt;TabAtkins> noamr: people want to control their progressive loading experience better. articles coming in, but don't want it to show while it's mid-loading<br>
&lt;TabAtkins> noamr: want to either indicate it's loading, or make it invisible until it's loaded<br>
&lt;TabAtkins> astearns: looking thru web components issue, i don't see any discussion about the current :loaded trigger we have<br>
&lt;TabAtkins> astearns: i think it woudl be good to see if our existing :loaded selector woudl be sufficient<br>
&lt;TabAtkins> fantasai: so q is, rather than using a new selector, is it good to reuse the existing selector?<br>
&lt;TabAtkins> fantasai: if you haven't thought about this yet, coudl be worth thinking about<br>
&lt;TabAtkins> fantasai: so do users *want* to distinguish between parsed and loaded?<br>
&lt;astearns> ack emilio<br>
&lt;TabAtkins> emilio: to impl this, you need add a [??] notification that elements have loaded, which some elements alreayd have<br>
&lt;ydaniv> this one is somewhat related, https://github.com/w3c/csswg-drafts/issues/8175<br>
&lt;TabAtkins> emilio: when previously discussed, i think there were perf constraints with doing this for all elements<br>
&lt;TabAtkins> emilio: there's a similar thing with... like having this pseudo-class - presumably if element is empty this'll never apply, only while getting chidlren<br>
&lt;TabAtkins> emilio: i'm a bit concerned about the number of style changes it adds to page loads<br>
&lt;TabAtkins> q+<br>
&lt;TabAtkins> emilio: like :has(:loading) suddenly invalidates constantly<br>
&lt;fantasai> s/loading/parsing/<br>
&lt;TabAtkins> emilio: my udnerstanding is in the past, blink folks objected to the more general idea here<br>
&lt;TabAtkins> emilio: in the html discussions<br>
&lt;TabAtkins> noamr: that was a JS thing, this is a style thing<br>
&lt;TabAtkins> emilio: at least for us, the "children are done" thing is an extra operation the parser send to the dom<br>
&lt;TabAtkins> emilio: i think rn we only use that for select and textarea, maybe two or three more<br>
&lt;TabAtkins> noamr: from chromium perspective, we do that- it's expensive, but we can do it based on existing selectors<br>
&lt;TabAtkins> emilio: there could be a stylesheet loading in flight, don't think you can do it conditionally<br>
&lt;TabAtkins> emilio: just saying, this has been dsicussed in the past. doesn't necessarily block, but would be good to have more feedback<br>
&lt;TabAtkins> emilio: but my udnerstanding is our parser folks wouldn't be very happy with this<br>
&lt;TabAtkins> noamr: i'll check, i have more parser knowledge than i did a year ago, not too concerned<br>
&lt;TabAtkins> noamr: when we added blocking for link rel=expect, similar thing<br>
&lt;TabAtkins> emilio: yeah, that's conditional tho<br>
&lt;TabAtkins> emilio: something that might be interesting is restricting this to elements the page cares about<br>
&lt;TabAtkins> emilio: so that might be good to investigate. you usually care about just one or two elements, not all sub-children<br>
&lt;TabAtkins> emilio: just like a main article<br>
&lt;TabAtkins> emilio: would be good to get some hint from the page about what elemens i care about<br>
&lt;astearns> ack TabAtkins<br>
&lt;emilio> TabAtkins: was going to suggest exactly that<br>
&lt;emilio> ... it's not a state we care about for ~all elements<br>
&lt;emilio> ... so maybe we can opt in at the markup level<br>
&lt;emilio> ... with an attribute or so, which would opt into the pseudo class<br>
&lt;emilio> ... that'd make me happier with reusing :loading/:loading<br>
&lt;emilio> ... usually that's a thing that applies more to images / videos<br>
&lt;emilio> ... but if it's just a handful of articles you have marked or so it seems fine<br>
</details>


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


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

Received on Thursday, 21 August 2025 07:37:35 UTC