Re: [csswg-drafts] [css-pseudo] Add a property to the `CSSPseudoElement` IDL interface to determine if a pseudo element "exists" (#12158)

The CSS Working Group just discussed ``[css-pseudo] Add a property to the `CSSPseudoElement` IDL interface to determine if a pseudo element "exists"``.

<details><summary>The full IRC log of that discussion</summary>
&lt;ydaniv> q+<br>
&lt;kbabbitt> sakhapov: I think we should resolve for pseudo element observer<br>
&lt;TabAtkins> q+<br>
&lt;kbabbitt> ... want to hear opinions<br>
&lt;astearns> ack ntim<br>
&lt;kbabbitt> ntim: first thought looking at this api is that why don't we just make element.pseudo return null<br>
&lt;kbabbitt> ... like querySelector returns null<br>
&lt;kbabbitt> astearns: because we already resolved on having the interface ...<br>
&lt;kbabbitt> sakhapov: discussions before<br>
&lt;kbabbitt> emilio: if you do that, you need to synchronously update layout, may wantobserver for pseudeo that doesn't exust yet<br>
&lt;kbabbitt> ... otherwise if you have a before pseudo that goes away then comes back, you don't want to expose whether underlying psedo ? or not<br>
&lt;kbabbitt> ntim: exists prop checks for htat?<br>
&lt;kbabbitt> emilio: but object may not be the same<br>
&lt;kbabbitt> astearns: successive iterations of same pseudo<br>
&lt;kbabbitt> ... it's a separate issue<br>
&lt;kbabbitt> ... given previous resolution we need to decide what to do here<br>
&lt;kbabbitt> sakhapov: previous discussion was in favor of consistent proxy<br>
&lt;kbabbitt> ... good arguments for that<br>
&lt;kbabbitt> astearns: other comments?<br>
&lt;emilio> q+<br>
&lt;kbabbitt> ntim: disagree with other issue<br>
&lt;kbabbitt> ... which affects this<br>
&lt;astearns> ack ydaniv<br>
&lt;kbabbitt> ydaniv: really like the observer approach<br>
&lt;kbabbitt> ... but we're doing something specific here with pseudos<br>
&lt;ntim> where can i find the other issue?<br>
&lt;kbabbitt> ... maybe we can open something more generic<br>
&lt;kbabbitt> ... last we talked, ? talks about having selector observer when things are added/removed that match a specific selector<br>
&lt;kbabbitt> ... maybe we want a more generic thing that also works for pseudos<br>
&lt;kbabbitt> ... or mutation observer that takes selector as filter<br>
&lt;kbabbitt> ... would like to see if we could consider that<br>
&lt;kbabbitt> astearns: sakhapov has that been considered?<br>
&lt;kbabbitt> sakhapov: no, mostly considered sync way, noam is in favor of observer, see use cases for both<br>
&lt;kbabbitt> ... heard opinions in favor of observer, want to hear in favor of exists property<br>
&lt;astearns> ack TabAtkins<br>
&lt;kbabbitt> TabAtkins: while the observer proposal from noam is a little complex to solve this, I think it's pretty well shaped<br>
&lt;kbabbitt> ... avoiding sync recalc is reasonable<br>
&lt;kbabbitt> ... agree there might be use cases for sync stuff but can pursue in future<br>
&lt;kbabbitt> ... support sticking with observer<br>
&lt;astearns> ack emilio<br>
&lt;kbabbitt> emilio: 2 things, if we do sync version , I'd rather make it a method than a getter<br>
&lt;kbabbitt> ... going to do underlying work to update layout tree etc.<br>
&lt;kbabbitt> ... also some of the use cases feel a bit dubious<br>
&lt;kbabbitt> ... don't think we want to expose whether spelling error exists<br>
&lt;ntim> spelling-error<br>
&lt;kbabbitt> ... or grammar error<br>
&lt;ntim> Is https://github.com/w3c/csswg-drafts/issues/12159 the other issue?<br>
&lt;kbabbitt> ... so not clear a lot of these have good answers for those<br>
&lt;kbabbitt> ... don't know what the right answer for those would be<br>
&lt;kbabbitt> sakhapov: ? said for privacy reasons we can't expose a number of pseudos<br>
&lt;kbabbitt> emilio: guess you want to return null when it's a tree state<br>
&lt;kbabbitt> ... true false or unexposed<br>
&lt;kbabbitt> sakhapov: there's a table in the issue<br>
&lt;kbabbitt> emilio: think that's a bad pattern, don't have a lot of nullable booleans<br>
&lt;kbabbitt> ... proposal for exists was nullable boolean<br>
&lt;kbabbitt> ... null if we can't answer<br>
&lt;kbabbitt> TabAtkins: don't think we have any nullable booleans right now<br>
&lt;kbabbitt> ...given that both null and false are false-y that fits simple test for is it there?<br>
&lt;kbabbitt> sakhapov: idea behind nullable bool was null = can't tell, false = not there<br>
&lt;kbabbitt> TabAtkins: both seem false-y to me, seems okay to me<br>
&lt;kbabbitt> emilio: feels like a lot of these ... for example first-letter, first-line<br>
&lt;kbabbitt> ... do you need a rule for them to match?<br>
&lt;kbabbitt> ... same for placeholder<br>
&lt;kbabbitt> ... could use .matches(placeholder)<br>
&lt;kbabbitt> ... highlights you know whether you have them because there's a registry<br>
&lt;kbabbitt> ... spelling error we don't want to expose<br>
&lt;kbabbitt> ... seems like theres very few where this would be useful<br>
&lt;kbabbitt> ... guess the observer, I wonder if we could reuse mutationobserver<br>
&lt;kbabbitt> astearns: that was ydaniv's suggestion<br>
&lt;kbabbitt> TabAtkins: can you filter a mutationobserver?<br>
&lt;kbabbitt> emilio: yes, only text changes, only additions, etc<br>
&lt;kbabbitt> TabAtkins: can you have default off things?<br>
&lt;kbabbitt> emilio: it's optional spec so potentially<br>
&lt;kbabbitt> ... also tricky thing with mutationobserver, we don't want to turn on details of when actual element gets createdx<br>
&lt;kbabbitt> ... seems to me like there's very few really compelling use cases for this given the complexity<br>
&lt;kbabbitt> astearns: I kind of like the idea of reusing something we already have<br>
&lt;kbabbitt> ... instead of creating something new<br>
&lt;kbabbitt> ... wonder if we should take this back to the issue, especially since noam's not here<br>
&lt;kbabbitt> ... and have him weigh ydaniv's idea against his proposal<br>
&lt;kbabbitt> sakhapov: sounds good<br>
&lt;kbabbitt> astearns: you can ping noam to say there's this other idea, and we'll weigh the alternatives<br>
&lt;kbabbitt> sakhapov: and sync version can be discussed later<br>
&lt;kbabbitt> astearns: ok, back to the issue<br>
</details>


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


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

Received on Friday, 14 November 2025 07:49:38 UTC