Skip to content

Commit 0bf0dbf

Browse files
committed
[css-variables] Specify how to handle loops with animation a custom property used in an animation property.
1 parent d245390 commit 0bf0dbf

2 files changed

Lines changed: 23 additions & 4 deletions

File tree

css-variables/Overview.bs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,14 @@ Custom Property Value Syntax</h3>
183183
can be made conditional with ''@media'' and other conditional rules,
184184
can be used in HTML's <code>style</code> attribute,
185185
can be read or set using the CSSOM, etc.
186+
186187
Notably, they can even be transitioned or animated,
187188
but since the UA has no way to interpret their contents,
188189
they always use the "flips at 50%" behavior
189190
that is used for any other pair of values that can't be intelligently interpolated.
191+
However, any <a>custom property</a> used in a ''@keyframes'' rule
192+
becomes <dfn>animation-tainted</dfn>,
193+
which affects how it is treated when referred to via the ''var()'' function in an animation property.
190194

191195
<div class='example'>
192196
This style rule:
@@ -386,6 +390,11 @@ Using Cascading Variables: the ''var()'' notation</h2>
386390
To <dfn export>substitute a var()</dfn> in a property's value:
387391

388392
<ol>
393+
<li>
394+
If the <a>custom property</a> named by the first argument to the ''var()'' function is <a>animation-tainted</a>,
395+
and the ''var()'' function is being used in the 'animation' property or one of its longhands,
396+
treat the <a>custom property</a> as having its initial value for the rest of this algorithm.
397+
389398
<li>
390399
If the value of the <a>custom property</a> named by the first argument to the ''var()'' function
391400
is anything but the initial value,

css-variables/Overview.html

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
</p>
5757
<h1 class="p-name no-ref" id=title>CSS Custom Properties for Cascading Variables Module Level 1</h1>
5858
<h2 class="no-num no-toc no-ref heading settled heading" id=subtitle><span class=content>Editor’s Draft,
59-
<span class=dt-updated><span class=value-title title=20140403>3 April 2014</span></span></span></h2>
59+
<span class=dt-updated><span class=value-title title=20140417>17 April 2014</span></span></span></h2>
6060
<div data-fill-with=spec-metadata><dl><dt>This version:<dd><a class=u-url href=http://dev.w3.org/csswg/css-variables/>http://dev.w3.org/csswg/css-variables/</a><dt>Latest version:<dd><a href=http://www.w3.org/TR/css-variables-1/>http://www.w3.org/TR/css-variables-1/</a><dt>Editor’s Draft:<dd><a href=http://dev.w3.org/csswg/css-variables/>http://dev.w3.org/csswg/css-variables/</a><dt>Previous Versions:<dd><a href=http://www.w3.org/TR/2013/WD-css-variables-1-20130620/ rel=previous>http://www.w3.org/TR/2013/WD-css-variables-1-20130620/</a><dd><a href=http://www.w3.org/TR/2013/WD-css-variables-20130312/ rel=previous>http://www.w3.org/TR/2013/WD-css-variables-20130312/</a><dd><a href=http://www.w3.org/TR/2012/WD-css-variables-20120410/ rel=previous>http://www.w3.org/TR/2012/WD-css-variables-20120410/</a>
6161
<dt>Feedback:</dt>
6262
<dd><a href="mailto:www-style@w3.org?subject=%5Bcss-variables%5D%20feedback">www-style@w3.org</a>
@@ -259,7 +259,7 @@ <h3 class="heading settled heading" data-level=2.1 id=syntax><span class=secno>2
259259

260260
<p class=note> Note: While <a class="production css-code" data-link-type=type href=#typedef-any-value title="<any-value>">&lt;any-value&gt;</a> must represent at least one token,
261261
that one token may be whitespace.
262-
This implies that <span class=css data-link-type=propdesc title=--foo>--foo: ;</span> is valid,
262+
This implies that <a class=css data-link-type=propdesc title=--foo>--foo: ;</a> is valid,
263263
and the corresponding <span class=css data-link-type=maybe title=var(--foo)>var(--foo)</span> call would have a single space as its substitution value,
264264
but <span class=css data-link-type=maybe title=--foo:;>--foo:;</span> is invalid.
265265

@@ -292,10 +292,14 @@ <h3 class="heading settled heading" data-level=2.1 id=syntax><span class=secno>2
292292
can be made conditional with <a class=css data-link-type=maybe href=http://dev.w3.org/csswg/css-conditional-3/#at-ruledef-media title=@media>@media</a> and other conditional rules,
293293
can be used in HTML’s <code>style</code> attribute,
294294
can be read or set using the CSSOM, etc.
295-
Notably, they can even be transitioned or animated,
295+
296+
<p> Notably, they can even be transitioned or animated,
296297
but since the UA has no way to interpret their contents,
297298
they always use the "flips at 50%" behavior
298299
that is used for any other pair of values that can’t be intelligently interpolated.
300+
However, any <a data-link-type=dfn href=#custom-property title="custom property">custom property</a> used in a <a class=css data-link-type=maybe href=http://dev.w3.org/csswg/css-animations-1/#at-ruledef-keyframes title=@keyframes>@keyframes</a> rule
301+
becomes <dfn data-dfn-type=dfn data-noexport="" id=animation-tainted>animation-tainted<a class=self-link href=#animation-tainted></a></dfn>,
302+
which affects how it is treated when referred to via the <a class=css data-link-type=maybe href=#funcdef-var title=var()>var()</a> function in an animation property.
299303

300304
<div class=example>
301305
This style rule:
@@ -457,6 +461,11 @@ <h2 class="heading settled heading" data-level=3 id=using-variables><span class=
457461
<p> To <dfn data-dfn-type=dfn data-export="" id=substitute-a-var>substitute a var()<a class=self-link href=#substitute-a-var></a></dfn> in a property’s value:
458462

459463
<ol>
464+
<li>
465+
If the <a data-link-type=dfn href=#custom-property title="custom property">custom property</a> named by the first argument to the <a class=css data-link-type=maybe href=#funcdef-var title=var()>var()</a> function is <a data-link-type=dfn href=#animation-tainted title=animation-tainted>animation-tainted</a>,
466+
and the <a class=css data-link-type=maybe href=#funcdef-var title=var()>var()</a> function is being used in the <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-animations-1/#propdef-animation title=animation>animation</a> property or one of its longhands,
467+
treat the <a data-link-type=dfn href=#custom-property title="custom property">custom property</a> as having its initial value for the rest of this algorithm.
468+
460469
<li>
461470
If the value of the <a data-link-type=dfn href=#custom-property title="custom property">custom property</a> named by the first argument to the <a class=css data-link-type=maybe href=#funcdef-var title=var()>var()</a> function
462471
is anything but the initial value,
@@ -835,6 +844,7 @@ <h2 class="no-num no-ref heading settled heading" id=index><span class=content>
835844
Index</span><a class=self-link href=#index></a></h2>
836845
<div data-fill-with=index><ul class=indexlist>
837846
<li>--*, <a href=#propdef--- title="section 2">2</a>
847+
<li>animation-tainted, <a href=#animation-tainted title="section 2.1">2.1</a>
838848
<li>&lt;any-value&gt;, <a href=#typedef-any-value title="section 2.1">2.1</a>
839849
<li>custom property, <a href=#custom-property title="section 2">2</a>
840850
<li>&lt;custom-property-name&gt;, <a href=#typedef-custom-property-name title="section 2">2</a>
@@ -847,6 +857,6 @@ <h2 class="no-num no-ref heading settled heading" id=index><span class=content>
847857
<h2 class="no-num no-ref heading settled heading" id=property-index><span class=content>
848858
Property index</span><a class=self-link href=#property-index></a></h2>
849859
<div data-fill-with=property-index><table class="proptable data"><thead><tr><th scope=col>Name<th scope=col>Value<th scope=col>Initial<th scope=col>Applies to<th scope=col>Inh.<th scope=col>%ages<th scope=col>Media<th scope=col>Animatable<th scope=col>Computed value<tbody>
850-
<tr><th scope=row><a data-property="">--*</a><td>&lt;any-value&gt;<td>(nothing, see prose)<td>all elements<td>yes<td><td>all<td>no<td>specified value with variables substituted (but see prose for "invalid variables")</table></div>
860+
<tr><th scope=row><a class=css-code data-link-type=property title=--*>--*</a><td>&lt;any-value&gt;<td>(nothing, see prose)<td>all elements<td>yes<td><td>all<td>no<td>specified value with variables substituted (but see prose for "invalid variables")</table></div>
851861

852862

0 commit comments

Comments
 (0)