Re: [csswg-drafts] [css-pseudo-4] should CSSPseudoElement have a pseudo() method? (#3836)

I personally think `.pseudo` should be able to return a pseudo-element for *any* name rather than just the hard coded list of `::marker`, `::before` and `::after`.

Why? Well a pseudo-element is meant to be transparent as to whether or not it points to single element, multiple elements, text nodes, etc. Because of the way they are specified it's only possible to target all such components or none of them in CSS, similarly I think it should work identically with `.pseudo` that a `CSSPseudoElement` represents all parts that are used to construct that element.

This would work fine with `getComputedStyle` too as there's no way to actually style individual parts of pseudo elements. So even if a `::part(foo)` corresponded to 50 elements, a `::part(foo)` selector can only style all 50 or none of them, so `getComputedStyle` is consistent (assuming `getComputedStyle` is not allowed to leak styles out).

Also it'd be nice with [reference selectors](https://github.com/w3c/csswg-drafts/issues/3714) or similar ideas too as then you could do `someElement.pseudo("::part(name)").references = [partStyles]`.

-- 
GitHub Notification of comment by Jamesernator
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3836#issuecomment-498514992 using your GitHub account

Received on Tuesday, 4 June 2019 04:18:27 UTC