RESOLVED WONTFIX 207291
Expose methods to retrieve a PseudoElement given a PseudoId on Element
https://bugs.webkit.org/show_bug.cgi?id=207291
Summary Expose methods to retrieve a PseudoElement given a PseudoId on Element
Antoine Quint
Reported 2020-02-05 13:11:52 PST
The Web Animations specification has added a `pseudoElement` property on `KeyframeEffect`, see bug 207290 tracking its implementation in WebKit. However, `Element` currently only exposes `beforePseudoElement` and `afterPseudoElement` and these are only created under certain circumstances, mostly if `content` is set for one of those pseudo-elements. It appears that pseudo-elements should also be created as needed to be the target of an animation, regardless of what `content` is set to. Specifically, the specification for `content: none` says: On elements, this inhibits the children of the element from being rendered as children of this element, as if the element was empty. On pseudo-elements it inhibits the creation of the pseudo-element as if it had display: none. In neither case does it prevent any pseudo-elements which have this element or pseudo-element as an originating element from being generated. It would be great to have a method along the lines of `Element::ensurePseudoElement(PseudoId)` where we can get a `PseudoElement` for any of our known pseudo-elements.
Attachments
Radar WebKit Bug Importer
Comment 1 2020-02-05 13:12:22 PST
Ryosuke Niwa
Comment 2 2020-02-05 14:38:07 PST
PseudoElement class in general is extremely underspec’ed (e.g. lifetime of these objects is completely unspecified or badly specified). So we need to figure out how PseudoElement’s lifecycle is managed.
Antoine Quint
Comment 3 2020-02-06 00:20:26 PST
Note that this request is unrelated to exposing PseudoElement, the Web Animations API only exposes an Element/CSSOMString pair.
Antti Koivisto
Comment 4 2020-02-06 06:36:41 PST
PseudoElement is an implementation detail, not exposed to web in any direct way. It was a bad idea from the start.
Antti Koivisto
Comment 5 2020-02-06 06:40:17 PST
I think it was originally added to make before/after animatable. The right way to do that would have been to make Element/pseudo pairs animatable rather adding a confusing internal Element subclass.
Antti Koivisto
Comment 6 2020-02-06 06:44:53 PST
Note that only before/after generate PseudoElements. I deliberately got rid of ensurePseudoElement(PseudoId) functions at some point to reduce confusion and prevent people from writing code that would create PseudoElements in other cases. The right direction here is to eliminate PseudoElement completely. Should be easier when the new animation system is fully in place.
Note You need to log in before you can comment on or make changes to this bug.