Skip to content

Commit 2a2691b

Browse files
committed
[css-animations] Rewrite the @Keyframes grammar as a CSS grammar. Ref the correct terms in a few spots in the same section.
1 parent 9b7faa3 commit 2a2691b

File tree

1 file changed

+31
-33
lines changed

1 file changed

+31
-33
lines changed

css-animations/Overview.bs

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -214,32 +214,44 @@ Keyframes</h2>
214214
during the animation. The keyframes specify the behavior of one cycle of the animation;
215215
the animation may iterate zero or more times.
216216

217-
Keyframes are specified using a specialized CSS at-rule. A <dfn>@keyframes</dfn> rule consists of the
218-
keyword "@keyframes", followed by either an identifier or a string giving a name for the animation (which will
219-
be referenced using 'animation-name'), followed by a set of style rules (delimited by curly
220-
braces).
221-
222-
The keyframe selector for a keyframe style rule consists of a comma-separated list of
223-
percentage values or the keywords ''from'' or ''to''. The selector is used to specify the
224-
percentage along the duration of the animation that the keyframe represents. The keyframe
225-
itself is specified by the block of property values declared on the selector. The keyword
226-
''from'' is equivalent to the value ''0%''. The keyword ''to'' is equivalent to the value ''100%''.
227-
<span class="note">Note that the percentage unit specifier must be used on percentage values.
228-
Therefore, ''0'' is an invalid keyframe selector.</span>
217+
Keyframes are specified using the <dfn>@keyframes</dfn> at-rule,
218+
defined as follows:
219+
220+
<pre>
221+
@keyframes = @keyframes [ <<custom-ident>> | <<string>> ] { <<rule-list>> }
222+
223+
<dfn>&lt;keyframe-block></dfn> = <<keyframe-selector>># { <<declaration-list>> }
224+
225+
<dfn>&lt;keyframe-selector></dfn> = from | to | <<percentage>>
226+
</pre>
227+
228+
The <<rule-list>> inside of ''@keyframes'' can only contain <<keyframe-block>> rules.
229+
230+
The <<declaration-list>> inside of <<keyframe-block>> accepts any CSS property
231+
except those defined in this specification,
232+
but <em>does</em> accept the 'animation-play-state' property
233+
and interprets it specially.
234+
None of the properties interact with the cascade
235+
(so using ''!important'' on them is invalid and will cause the property to be ignored).
236+
237+
The <<keyframe-selector>> for a <<keyframe-block>> consists of a comma-separated list of percentage values or the keywords ''from'' or ''to''. The selector is used to specify the percentage along the duration of the animation that the keyframe represents. The keyframe itself is specified by the block of property values declared on the selector. The keyword ''from'' is equivalent to the value ''0%''. The keyword ''to'' is equivalent to the value ''100%''.
238+
Values less than ''0%'' or higher than ''100%'' are invalid
239+
and cause their <<keyframe-block>> to be ignored.
240+
241+
<span class="note">Note that the percentage unit specifier must be used on percentage values. Therefore, ''0'' is an invalid keyframe selector.</span>
229242

230243
If a ''0%'' or ''from'' keyframe is not specified, then the user agent constructs a ''0%'' keyframe
231244
using the computed values of the properties being animated. If a ''100%'' or ''to'' keyframe is not
232245
specified, then the user agent constructs a ''100%'' keyframe using the computed values of the
233-
properties being animated. If a keyframe selector specifies negative percentage values or values
234-
higher than ''100%'', then the keyframe will be ignored.
246+
properties being animated.
235247

236-
The keyframe declaration block for a keyframe rule consists of properties and values. The properties
248+
The <<keyframe-block>> contains properties and values. The properties
237249
defined by this specification are ignored in these rules, with the exception of
238-
'animation-timing-function', the behavior of which is described below. In addition, keyframe rule
239-
declarations qualified with !important are ignored.
250+
'animation-timing-function', the behavior of which is described below. In addition, properties qualified with !important are invalid and ignored.
240251

241-
The @keyframes rule that is used by an animation will be the last one encountered in sorted rules
242-
order that matches the name of the animation specified by the 'animation-name' property.
252+
If multiple ''@keyframes'' rules are defined with the same name,
253+
the last one in document order wins,
254+
and all preceding ones are ignored.
243255

244256
<div class='example'>
245257
<pre>
@@ -333,20 +345,6 @@ Keyframes</h2>
333345
</figure>
334346
</div>
335347

336-
The following is the grammar for the keyframes rule:
337-
338-
<pre>
339-
keyframes_rule: KEYFRAMES_SYM S+ IDENT S* '{' S* keyframes_blocks '}' S*;
340-
341-
keyframes_blocks: [ keyframe_selector '{' S* declaration? [ ';' S* declaration? ]* '}' S* ]* ;
342-
343-
keyframe_selector: [ FROM_SYM | TO_SYM | PERCENTAGE ] S* [ ',' S* [ FROM_SYM | TO_SYM | PERCENTAGE ] S* ]*;
344-
345-
@{K}{E}{Y}{F}{R}{A}{M}{E}{S} {return KEYFRAMES_SYM;}
346-
{F}{R}{O}{M} {return FROM_SYM;}
347-
{T}{O} {return TO_SYM;}
348-
</pre>
349-
350348
<p class="issue">
351349
This specification needs to define
352350
how the value is determined from the keyframes,

0 commit comments

Comments
 (0)