- From: Lea Verou via GitHub <sysbot+gh@w3.org>
- Date: Tue, 05 Nov 2024 17:49:38 +0000
- To: public-css-archive@w3.org
I had just filed a new issue for this (#11154): > Currently, `:*-child` pseudo-classes only consider element children, and will match even if the element has text nodes before it. For example, in `<button>foo <i>A</i> bar</button>` `:first-child`, `:last-child` and `:only-child` will all match. For many use cases, it is important to match when the node is *actually* the first/last/only one. > > I have not found use cases requiring `:nth-node()`, so I think the three titular pseudos should do it. The use case that prompted it was very similar to the one mentioned: handling icons in the beginning of a button/menu item/tab/etc as a prefix icon, and if at the end as a suffix icon (slotting them into corresponding slots in components etc). Also, given that text nodes create anonymous boxes wrt grid/flex handling, it seems like the ship has sailed and we can't really keep pretending that text nodes don't exist for the purposes of CSS. 😁 -- GitHub Notification of comment by LeaVerou Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3216#issuecomment-2457817193 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 5 November 2024 17:49:38 UTC