Skip to content
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

[web-animations-1] Add pseudoElement to getAnimations options #11050

Merged
merged 2 commits into from
Oct 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 52 additions & 27 deletions web-animations-1/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -5631,27 +5631,33 @@ The {{KeyframeEffect}} interface {#the-keyframeeffect-interface}

On setting,
sets the [=target pseudo-selector=] of the [=animation effect=]
to the provided value
after applying the following exceptions:

* If the provided value is not `null`
and is an [=invalid selector|invalid=] <<pseudo-element-selector>>,
the user agent must [=throw=] a {{DOMException}}
with error name "{{SyntaxError}}" and leave the
[=target pseudo-selector=] of this [=animation effect=] unchanged.

Note: Invalid in this context follows the definition of
an [=invalid selector=] defined in [[!SELECTORS-4]]
such that syntactically invalid pseudo-elements
as well as pseudo-elements for which the user agent
has no usable level of support
are both deemed invalid.

* If one of the legacy Selectors Level 2 single-colon selectors
(':before', ':after', ':first-letter', or ':first-line')
is specified,
the [=target pseudo-selector=] must be set
to the equivalent two-colon selector (e.g. '::before').
to the result of <dfn>pseudo-element parsing</dfn> on the provided value,
defined as the following:

1. Given the value |value|, perform the following steps:
1. If |value| is not `null`
and is an [=invalid selector|invalid=] <<pseudo-element-selector>>,

1. [=Throw=] a {{DOMException}}
with error name "{{SyntaxError}}".

1. Abort.

Note: In effect, this means that if the result of this algorithm is
used to set a variable, then that variable remains unchanged.

Note: Invalid in this context follows the definition of
an [=invalid selector=] defined in [[!SELECTORS-4]]
such that syntactically invalid pseudo-elements
as well as pseudo-elements for which the user agent
has no usable level of support
are both deemed invalid.

1. If |value| is one of the legacy Selectors Level 2 single-colon selectors
(':before', ':after', ':first-letter', or ':first-line'), then
return the equivalent two-colon selector (e.g. '::before').

1. Otherwise, return |value|.

: <dfn>composite</dfn>
::
Expand Down Expand Up @@ -6652,6 +6658,7 @@ The <code>Animatable</code> interface mixin {#the-animatable-interface-mixin}

dictionary GetAnimationsOptions {
boolean subtree = false;
CSSOMString? pseudoElement = null;
};
</xmp>

Expand Down Expand Up @@ -6733,12 +6740,24 @@ The <code>Animatable</code> interface mixin {#the-animatable-interface-mixin}

: <dfn lt="getAnimations(options)">sequence<Animation> getAnimations(|options|)</dfn>
::
Returns the set of [=relevant animations=] for this object,
or, if an {{Animatable/getAnimations(options)/options}} parameter
is passed with {{GetAnimationsOptions/subtree}} set to true,
returns the set of [=relevant animations for a subtree=] for this object.
1. Let |object| be the object on which this method was called.

1. Let |pseudoElement| be the result of {{KeyframeEffect/pseudo-element parsing}}
applied to {{GetAnimationsOptions/pseudoElement}} of {{Animatable/getAnimations(options)/options}},
or `null` if {{Animatable/getAnimations(options)/options}} is not passed.

1. If |pseudoElement| is not `null`,
then let |target| be the [=pseudo-element=]
identified by |pseudoElement|
with |object| as the originating element.
Otherwise, let |target| be |object|.

The returned list is sorted using
1. If {{Animatable/getAnimations(options)/options}} is passed
with {{GetAnimationsOptions/subtree}} set to true,
then return the set of [=relevant animations for a subtree=] of |target|.
Otherwise, return the set of [=relevant animations=] for |target|.

The list returned by the above algorithm is sorted using
the composite order described for the associated [=animations=]
of effects in [[#the-effect-stack]].

Expand Down Expand Up @@ -6782,6 +6801,12 @@ The <code>Animatable</code> interface mixin {#the-animatable-interface-mixin}
on which {{Animatable/getAnimations()}} is called
should also be included in the result.

: <dfn for=GetAnimationsOptions>pseudoElement</dfn>
::
If set, indicates that the target of the operation is the [=pseudo-element=]
identified by this pseudo selector (e.g. `::before`)
with the originating element being the object on which the function is called.

</div>

Extensions to the {{Document}} interface {#extensions-to-the-document-interface}
Expand Down Expand Up @@ -7268,4 +7293,4 @@ Animation of 'box-shadow' and 'text-shadow' {#animating-shadow-lists}
follows the matching rules for interpolation above,
performing addition on each component according to its type,
or falling back to [=discrete=] animation
if the ''shadow/inset'' values do not match.
if the ''shadow/inset'' values do not match.