Skip to content

Commit c03272e

Browse files
authored
[web-animations-1] Resolve remaining issues missed in pseudo-element change. (#4616)
Fixup of #4437 addressing #4301. * Add pseudoElement option to KeyframeEffect constructor body * Fixes #4502 by adding catch-all pseudo-element case to composite order * Fixes #4586 by adding error handling to KeyframeEffect.pseudoElement * Fixes #4701 by handling cases when property values cannot be calculated
1 parent 0d798c5 commit c03272e

File tree

3 files changed

+46
-7
lines changed

3 files changed

+46
-7
lines changed

css-animations-2/Overview.bs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ last) as follows:
167167
* element
168168
* ::marker
169169
* ::before
170+
* any other pseudo-elements not mentioned specifically in this list,
171+
sorted in ascending order by the Unicode codepoints that make up each selector
170172
* ::after
171173
* element children
172174

css-transitions-2/Overview.bs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ are sorted in composite order (first to last) as follows:
137137
* element
138138
* ::marker
139139
* ::before
140+
* any other pseudo-elements not mentioned specifically in this list,
141+
sorted in ascending order by the Unicode codepoints that make up each selector
140142
* ::after
141143
* element children
142144

web-animations-1/Overview.bs

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3201,6 +3201,10 @@ If the [=effect target=] is a [=pseudo-element=], the [=target element=] is
32013201
its [=originating element=] and the [=target pseudo-selector=] is as required
32023202
to specify that particular [=pseudo-element=].
32033203

3204+
Note that not all [=effect targets=] specified in this manner (such as ''::part()''
3205+
pseudo-elements and unsupported pseudo-elements) have
3206+
computed property values defined.
3207+
32043208
### Keyframes ### {#keyframes-section}
32053209

32063210
The <a>effect values</a> for a <a>keyframe effect</a>
@@ -3351,8 +3355,7 @@ an <a>effect target</a> for which computed property values can be calculated.
33513355
1. Return <var>computed keyframes</var>.
33523356

33533357

3354-
<h4 id="the-effect-value-of-a-keyframe-animation-effect">The effect value of
3355-
a keyframe effect</h4>
3358+
### The effect value of a keyframe effect ### {#the-effect-value-of-a-keyframe-animation-effect}
33563359

33573360
The <a>effect value</a> of a single property referenced by a <a>keyframe
33583361
effect</a> as one of its <a lt="target property">target properties</a>, for a
@@ -3366,6 +3369,9 @@ given <var>iteration progress</var>, <var ignore=''>current iteration</var> and
33663369
1. If <a>animation type</a> of the <var>target property</var> is
33673370
<a>not animatable</a> abort this procedure
33683371
since the effect cannot be applied.
3372+
1. If the [=keyframe effect=] does not have an [=effect target=],
3373+
or if the [=effect target=] cannot have computed property values
3374+
calculated, abort this procedure.
33693375
1. Define the <dfn>neutral value for composition</dfn> as a value
33703376
which, when combined with an <a>underlying value</a> using the <a
33713377
lt="composite operation add">add</a> <a>composite
@@ -4699,6 +4705,22 @@ interface KeyframeEffect : AnimationEffect {
46994705

47004706
1. Set the <a>target element</a> of <var>effect</var> to <var>target</var>.
47014707

4708+
1. Set the [=target pseudo-selector=] to the result corresponding to the first
4709+
matching condition from below.
4710+
4711+
: If <var>options</var> is a {{KeyframeEffectOptions}} object with a
4712+
{{KeyframeEffectOptions/pseudoElement}} property,
4713+
:: Set the [=target pseudo-selector=] to the value of the
4714+
{{KeyframeEffectOptions/pseudoElement}} property.
4715+
4716+
When assigning this property, the error-handling defined for the
4717+
{{KeyframeEffect/pseudoElement}} setter on the interface is applied.
4718+
If the setter requires an exception to be thrown, this procedure
4719+
must throw the same exception and abort all further steps.
4720+
4721+
: Otherwise,
4722+
:: Set the [=target pseudo-selector=] to `null`.
4723+
47024724
1. Let <var>timing input</var> be the result corresponding to the first
47034725
matching condition from below.
47044726

@@ -4807,11 +4829,24 @@ interface KeyframeEffect : AnimationEffect {
48074829

48084830
: <dfn attribute for=KeyframeEffect>pseudoElement</dfn>
48094831
:: The [=target pseudo-selector=].
4810-
This is `null` if the [=effect target=] is an {{Element}} or is itself `null`.
4811-
When not `null`, this must be a [=pseudo-element=] selector with
4812-
[[selectors-4#pseudo-element-syntax|valid syntax]].
4813-
This will not accept invalid values and will always return the selector in
4814-
its canonical form (i.e. `::before` instead of `:before`).
4832+
`null` if this effect has no [=effect target=] or
4833+
if the [=effect target=] is an element (i.e. not a pseudo-element).
4834+
When the [=effect target=] is a pseudo-element,
4835+
this specifies the pseudo-element selector (e.g. `::before`).
4836+
4837+
On setting,
4838+
sets the [=target pseudo-selector=] of the [=animation effect=]
4839+
to the provided value after applying the following exceptions:
4840+
4841+
* If the provided value is not `null` or a syntactically valid
4842+
<pseudo-element-selector> the user agent must [=throw=]
4843+
a {{DOMException}} with error name {{TypeError}} and leave the
4844+
[=target pseudo-selector=] of this [=animation effect=] unchanged.
4845+
4846+
* If one of the legacy Selectors Level 2 single-colon selectors
4847+
(':before', ':after', ':first-letter', or ':first-line') is
4848+
specified, the [=target pseudo-selector=] must be set to the
4849+
equivalent two-colon selector (e.g. '::before').
48154850

48164851
: <dfn attribute for=KeyframeEffect>composite</dfn>
48174852
:: The <a>composite operation</a> used to composite this

0 commit comments

Comments
 (0)