Re: [csswg-drafts] [css-pseudo] more clearly define which pseudo-elements are tree-abiding or part-like (#10794)

The CSS Working Group just discussed `[css-pseudo] more clearly define which pseudo-elements are tree-abiding or part-like`.

<details><summary>The full IRC log of that discussion</summary>
&lt;fantasai> Related: https://github.com/w3c/csswg-drafts/pull/10839/files<br>
&lt;dholbert> dbaron: we introduced this concept of ::part-like pseudo-elements<br>
&lt;dholbert> dbaron: there's a few different ways to think about it; I like to think it's a pseudo-element where underneath there's actually an element. So you can do most things with it<br>
&lt;dholbert> dbaron: ::part lets you use a pseudo element that was part of the shadow tree<br>
&lt;dholbert> dbaron: we're adding another way to do for form-controls that's similar<br>
&lt;dholbert> dbaron: we've added tree-abiding pseudo elements. they support a smaller set of things. General assumption: we can make a tree out of them<br>
&lt;dholbert> dbaron: they're not things like ::selection that cross the tree in random ways<br>
&lt;dholbert> dbaron: they're like ::before which lives in the tree at this place, and it has clearly-defined before/after siblings<br>
&lt;dholbert> dbaron: we have a lot of pseudo-elements in different specs. We need to be sure the ones that should be defined as ::part-like are defined that way, and same for tree-abiding, and we should say which ones aren't those things too<br>
&lt;dholbert> dbaron: I tried to make a list of which pseudo-elements go in each bucket<br>
&lt;emilio> q+<br>
&lt;dholbert> dbaron: I'd like other folks to take a look, especially the ones that I put question marks next to<br>
&lt;dholbert> dbaron: this is in the last comment in the issue, https://github.com/w3c/csswg-drafts/issues/10794#issuecomment-2379912294<br>
&lt;Rossen6> ack fantasai<br>
&lt;dholbert> fantasai: there are multiple categories of pseudo-elements. we should be sure the names for the categories are reasonable<br>
&lt;dholbert> fantasai: "tree-abiding" seems reasonable. we have some that are restricted in terms of which properties they can take (e.g. ::before vs ::marker)<br>
&lt;dholbert> fantasai: "tree-abiding and takes any property", "tree-abiding but restricted", and "part-like" -- are those the 3 categories?<br>
&lt;dholbert> dbaron: we've already allowed pseudo elements to have hand-written restrictions<br>
&lt;dholbert> dbaron: everything not in the ::part-like bucket has some restrictions hand-written at its definition<br>
&lt;dholbert> dbaron: there are also a bunch of general rules about how selectors combine, more than about what properties are used<br>
&lt;dholbert> dbaron: ::part-like pseudo elements do allow any properties, but the more interesting part is about how you can combine selectors<br>
&lt;dholbert> dbaron: anything that's not part-like has custom prose saying which properties are allowed<br>
&lt;kbabbitt> q+<br>
&lt;Rossen6> ack emilio<br>
&lt;flackr> w.r.t. having a known location in the tree, see https://drafts.csswg.org/css-animations-2/#animation-composite-order<br>
&lt;dholbert> emilio: I think your list is pretty reasonable. I don't think all the tree-abiding pseudos support the content property<br>
&lt;dholbert> dbaron: that was me reading the spec, not checking reality<br>
&lt;dholbert> dbaron: I looked through all the specs for things that reference those definitions<br>
&lt;dholbert> dbaron: in reality support for the content property does not match the spec<br>
&lt;dholbert> emilio: ::backdrop might not be implemented as an element in all engines... as a box, in all engines?<br>
&lt;dholbert> fantasai: that's how it should be defined. There's no reason for it to have an element backing...<br>
&lt;dholbert> emilio: not sure if all impls make it an element. if they don't make it an element, I'm not sure it should be tree-abiding?<br>
&lt;andreubotella> q+<br>
&lt;dholbert> fantasai: it does fit in the tree. stuff that's not tree-abiding is stuff that crosses element boundaries. ::first-letter, ::first-line, all that stuff<br>
&lt;kbabbitt> q-<br>
&lt;dholbert> emilio: ::cue might be ::part-like<br>
&lt;dholbert> emilio: and also [...]<br>
&lt;dholbert> emilio: for now we can go with -- if an engine doesn't implement it as a part, we can consider it not-part-like, and we can sort out more later<br>
&lt;dholbert> emilio: my other intuition for part-like vs. not is whether there's an actual dom element behind it, that isn't created by layout<br>
&lt;dholbert> emilio: (::before and ::after and ::marker are special)<br>
&lt;dholbert> emilio: but generally, my list would match yours, except for maybe ::backdrop and ::cue<br>
&lt;Rossen6> ack andreubotella<br>
&lt;emilio> perhaps ::placeholder could be part-like<br>
&lt;emilio> Once we define how `&lt;input>` is laid out<br>
&lt;emilio> One of these days ;)<br>
&lt;dholbert> andreubotella: you could think of ??? as selecting something in the flattened element tree, tree-abiding as selecting something in the box tree<br>
&lt;kbabbitt> s/???/part-like/<br>
&lt;dholbert> andreubotella: do these pseudo-elements have some particular distinction? does it make sense to group them in this way, depending on what they select into?<br>
&lt;jarhar> q?<br>
&lt;dholbert> andreubotella: first and last select into the fragment tree, and nth-fragment also<br>
&lt;kbabbitt> s/first and last/::first-line and ::nth-fragment()/<br>
&lt;dholbert> andreubotella: does it make sense to treat these as a separate category? or are the restrictions on those similar enough to the groups you've defined already?<br>
&lt;dholbert> dbaron: It may well make sense to describe that as a category<br>
&lt;dholbert> dbaron: I'm not aware of any common definition, so I'm hesitant to define spec terms if we don't have a reason to do so<br>
&lt;dholbert> dbaron: but the classification makes some sense<br>
&lt;jarhar> q+<br>
&lt;kbabbitt> I think dbaron's list makes sense for the selectors that I understand<br>
&lt;dholbert> dbaron: might be premature to take a resolution on this one. but I'd encourage discussion on the issue<br>
&lt;Rossen6> ack jarhar<br>
&lt;dholbert> jarhar: for the classification question/concepts: hopefully this is related... On Mon or Tues at a joint meeting, I brought up whether new pseudo elements for customizable select should be before-like or part-like<br>
&lt;dholbert> jarhar: there weren't spec concepts for this but it's important for implementation<br>
&lt;dholbert> jarhar: if I want to make it part-like, I need to wire it to shadow tree, real element in the tree, etc<br>
&lt;dholbert> jarhar: would be useful to have some kind of distinction for implementors, to help steer impl strategies<br>
&lt;dholbert> jarhar: (on new pseudos)<br>
&lt;emilio> q+<br>
&lt;dholbert> emilio: that's the main distinction. tree-abiding may encompass other things that are like generated content<br>
&lt;dholbert> emilio: we want to make part-like be things that have an element behind, unrelated to the styling of the parent<br>
&lt;dholbert> emilio: that's how a lot of the form-control shadow trees are implemented<br>
&lt;Rossen6> ack emilio<br>
&lt;dholbert> emilio: I'm pretty sure gecko/webkit have same kinds of assumptions about generated content. It'd be kinda hard to support a lot of these pseudo-classes on before/after<br>
&lt;dholbert> emilio: depending on how we decide to make a pseudo-element work, you need to take one approach or the other to implmeent it<br>
&lt;dholbert> fantasai: could you implement a tree-abiding as a part-like pseudo-element?<br>
&lt;dholbert> emilio: you could, it'd be more restricted<br>
&lt;dholbert> emilio: if you have an actual DOM element, you can implement a part-like and tree-abiding pseudo-element<br>
&lt;dholbert> fantasai: you can't implement a part-like pseudo without an actual element backing it, without a lot of work<br>
&lt;dholbert> fantasai:  ...<br>
&lt;dholbert> emilio: that's how placeholder is implemented in webkit and blink<br>
&lt;fantasai> s/.../but you could implement tree-abiding as a part-like pseudo-element with some disabled features/<br>
&lt;dholbert> emilio: we could change how gecko works to work that way too<br>
&lt;dholbert> emilio: but that's not great if we don't define what tree it is and what it works<br>
&lt;dholbert> Rossen6: let's move on<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10794#issuecomment-2380241579 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:41:52 UTC