@@ -879,11 +880,13 @@ IDL Definition
readonly attribute CSSOMString animationName;
readonly attribute double elapsedTime;
readonly attribute CSSOMString pseudoElement;
+ readonly attribute CSSPseudoElement? pseudoTarget;
};
dictionary AnimationEventInit : EventInit {
CSSOMString animationName = "";
double elapsedTime = 0.0;
CSSOMString pseudoElement = "";
+ CSSPseudoElement? pseudoTarget = null;
};
@@ -905,10 +908,52 @@ Attributes
runs (in which case the target of the event is that pseudo-element's corresponding
element), or the empty string if the animation runs on an element (which means the
target of the event is that element).
+
pseudoTarget
+
+ The [=pseudo-element=] that was the target of the animation,
+ if any. When the event target is an element rather than a
+ [=pseudo-element=], this attribute is null.
+
+ Each {{AnimationEvent}} has an associated pseudoTargetOrigin
+ internal slot (an {{Element}} or null), initialized to
+ null, and an associated pseudoTarget
+ internal slot (a {{CSSPseudoElement}} or null), initialized to
+ null.
+
+ To get this attribute, run these steps:
+
+ 1. If the [=AnimationEvent/pseudoTargetOrigin=] internal slot is null, then return null.
+ 1. Let |currentTarget| be {{Event/currentTarget}}.
+ 1. If |currentTarget| is null, then return null.
+ 1. Let |origin| be the [=AnimationEvent/pseudoTargetOrigin=] internal slot.
+ 1. Let |retargeted| be the result of [=retarget=]ing |origin| against |currentTarget|.
+ 1. If |retargeted| is not |origin|, then return null.
+ 1. Return the [=AnimationEvent/pseudoTarget=] internal slot.
+
+ The un-initialized value of this attribute MUST be
+ null.
+
+ Note: {{AnimationEvent/pseudoTarget}} and {{AnimationEvent/pseudoElement}} are intentionally
+ not equivalent. Because {{AnimationEvent/pseudoTarget}} returns a {{CSSPseudoElement}}
+ object, it is subject to retargeting and encapsulation. Therefore, if the event's target
+ is a pseudo-element inside a shadow tree, {{AnimationEvent/pseudoTarget}} will
+ return null when observed from outside the shadow tree, while
+ {{AnimationEvent/pseudoElement}} will still contain the pseudo-element's name.
AnimationEvent(type, animationEventInitDict) is an event constructor.
+ If |animationEventInitDict|'s {{AnimationEventInit/pseudoTarget}} is not null:
+
+ 1. Set |event|'s [=AnimationEvent/pseudoTarget=] internal slot = |animationEventInitDict|'s {{AnimationEventInit/pseudoTarget}}
+ 1. Set |event|'s [=AnimationEvent/pseudoTargetOrigin=] = |animationEventInitDict|'s {{AnimationEventInit/pseudoTarget}}'s {{CSSPseudoElement/element}}
+
+ When the UA dispatches an {{AnimationEvent}} for an animation running on a
+ [=pseudo-element=], it must set the event's [=AnimationEvent/pseudoTarget=] internal slot
+ to the {{CSSPseudoElement}} representing that pseudo-element, and set the
+ [=AnimationEvent/pseudoTargetOrigin=] internal slot to that
+ {{CSSPseudoElement}}'s {{CSSPseudoElement/element}}.
+