-
Notifications
You must be signed in to change notification settings - Fork 787
[css-animations-1][css-transitions-1] Add .pseudoTarget to AnimationEvent and TransitionEvent #13603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[css-animations-1][css-transitions-1] Add .pseudoTarget to AnimationEvent and TransitionEvent #13603
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,6 +38,7 @@ urlPrefix: https://html.spec.whatwg.org/multipage/infrastructure.html; type: dfn | |
| </pre> | ||
| <pre class="link-defaults"> | ||
| spec:cssom-1; type:interface; text:CSSRule | ||
| spec:css-pseudo-4; type:interface; text:CSSPseudoElement | ||
| </pre> | ||
|
|
||
| <h2 id="intro"> | ||
|
|
@@ -879,11 +880,13 @@ IDL Definition</h4> | |
| 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; | ||
| }; | ||
| </pre> | ||
|
|
||
|
|
@@ -905,10 +908,43 @@ Attributes</h4> | |
| 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). | ||
| <dt><dfn>pseudoTarget</dfn> | ||
| <dd> | ||
| 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 <code>null</code>. | ||
|
|
||
| Each {{AnimationEvent}} has an associated <dfn dfn-type=dfn for="AnimationEvent">pseudoTargetOrigin</dfn> | ||
| internal slot (an {{Element}} or <code>null</code>), initialized to | ||
| <code>null</code>. | ||
|
|
||
| To get this attribute, run these steps: | ||
|
|
||
| 1. If the [=AnimationEvent/pseudoTargetOrigin=] internal slot is <code>null</code>, then return <code>null</code>. | ||
| 1. Let |currentTarget| be {{Event/currentTarget}}. | ||
| 1. If |currentTarget| is <code>null</code>, then return <code>null</code>. | ||
| 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 <code>null</code>. | ||
| 1. Return {{AnimationEvent/pseudoTarget}}. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if this is formally correct. This seems to be treating There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this is similar to CommandEvent.source. |
||
|
|
||
| The <a>un-initialized value</a> of this attribute MUST be | ||
| <code>null</code>. | ||
| </dl> | ||
|
|
||
| <dfn dfn-type=constructor for=AnimationEvent>AnimationEvent(type, animationEventInitDict)</dfn> is an <a>event constructor</a>. | ||
|
|
||
| If |animationEventInitDict|'s {{AnimationEventInit/pseudoTarget}} is not <code>null</code>: | ||
|
|
||
| 1. Set |event|.{{AnimationEvent/pseudoTarget}} = |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}} | ||
| to the {{CSSPseudoElement}} representing that pseudo-element, and set the | ||
| [=AnimationEvent/pseudoTargetOrigin=] internal slot to that | ||
| {{CSSPseudoElement}}'s {{CSSPseudoElement/element}}. | ||
|
|
||
| <h3 id="event-animationevent"> | ||
| Types of <code>AnimationEvent</code></h3> | ||
|
|
||
|
|
@@ -931,7 +967,7 @@ Types of <code>AnimationEvent</code></h3> | |
| <ul> | ||
| <li>Bubbles: Yes</li> | ||
| <li>Cancelable: No</li> | ||
| <li>Context Info: animationName, elapsedTime, pseudoElement</li> | ||
| <li>Context Info: animationName, elapsedTime, pseudoElement, pseudoTarget</li> | ||
| </ul> | ||
|
|
||
| <dt><dfn>animationend</dfn> | ||
|
|
@@ -942,7 +978,7 @@ Types of <code>AnimationEvent</code></h3> | |
| <ul> | ||
| <li>Bubbles: Yes</li> | ||
| <li>Cancelable: No</li> | ||
| <li>Context Info: animationName, elapsedTime, pseudoElement</li> | ||
| <li>Context Info: animationName, elapsedTime, pseudoElement, pseudoTarget</li> | ||
| </ul> | ||
|
|
||
| <dt><dfn>animationiteration</dfn> | ||
|
|
@@ -961,7 +997,7 @@ Types of <code>AnimationEvent</code></h3> | |
| <ul> | ||
| <li>Bubbles: Yes</li> | ||
| <li>Cancelable: No</li> | ||
| <li>Context Info: animationName, elapsedTime, pseudoElement</li> | ||
| <li>Context Info: animationName, elapsedTime, pseudoElement, pseudoTarget</li> | ||
| </ul> | ||
|
|
||
| <dt><dfn>animationcancel</dfn> | ||
|
|
@@ -985,7 +1021,7 @@ Types of <code>AnimationEvent</code></h3> | |
| <ul> | ||
| <li>Bubbles: Yes</li> | ||
| <li>Cancelable: No</li> | ||
| <li>Context Info: animationName, elapsedTime, pseudoElement</li> | ||
| <li>Context Info: animationName, elapsedTime, pseudoElement, pseudoTarget</li> | ||
| </ul> | ||
| </dl> | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like the definitions of
pseudoTargetandpseudoElementshould probably be equivalent, in that I would expect thatpseudoElementandpseudoTarget.typeshould be the same.However, the definitions seems sufficiently different right now that I wonder if that's actually the case, for example, if the pseudo-element is in a shadow tree and the retargeting algorithm affects things.
Are they intended to be equivalent as I would expect, or are they intended to be different? (I think it should be clear either way.)