Re: [csswg-drafts] [css-pseudo-4] Decide between Element.pseudo(type) and window.getPseudoElements(elem, type) (#3541)

We need some wording about the identity of the object returned by `pseudo()`, for example whether it's required to be the same object each time you call it on an element with a given type.

Now that I think about it, if we do require that the same object is returned, what does it mean for the `CSSPseudoElement` object if we restyle the element and the pseudo goes away (and so `null` would be returned from another call to `pseudo()`)?  Is the `CSSPseudoElement` detached in some way?  If we restyle again and the pseudo-element is recreated, does the old `CSSPseudoElement` remain functional?  Might it be simpler to always return an object for a supported pseudo type, regardless of whether the pseudo currently exists?

I wonder if we should leave `::selection` off this list.  It feels like a pretty different thing from `::before`, `::after`, `::first-letter`, and `::first-line`, all of which basically have a box corresponding to them (at least for Gecko).  Or would it be allowed to return a `CSSPseudoElement` for `::selection` but not to support e.g. Web Animations targeting it?

The sentence

> The EventTarget interface [DOM-LEVEL-2-EVENTS] must be implemented by all instances of CSSPseudoElement as a conformance requirement of this module.

is redundant with the `CSSPseudoElement implements EventTarget;` line in the IDL, so we probably don't need it.

If the answer to #3540 is to remove `.style`, then yes I think all the issues in this section can be removed.  If no, then we should do what that issue says, and make the rules in there cascade normally.  (For the purposes of getting what we need for Web Animations targeting we don't need `.style`, but I'll let @birtles reply definitively in the other issue.)

Otherwise the change looks good to me, thanks.

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

Received on Saturday, 2 February 2019 05:20:13 UTC