[css-pseudo-4] Identity of Element.pseudo() return value (original) (raw)

@heycam wrote in #3541 (comment):


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?