Skip to content

Commit df9c299

Browse files
committed
[css-transitions-2] Add 'requirements on pending style changes' section
1 parent 4d71e6e commit df9c299

2 files changed

Lines changed: 95 additions & 0 deletions

File tree

css-transitions-2/Overview.bs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,44 @@ elsewhere</a>.
207207

208208
</div>
209209

210+
## Requirements on pending style changes ## {#requirements-on-pending-style-changes}
211+
212+
Various operations may affect the <a lt="computed value">computed values</a> of
213+
properties on elements. User agents may, as an optimization, defer recomputing
214+
these values until it becomes necessary.
215+
However, all operations included in programming interface defined in this
216+
specification, as well as those operations defined in Web Animations
217+
[[!WEB-ANIMATIONS]] that may return objects defined by this specification,
218+
must produce a result consistent with having fully processed any such pending
219+
changes to computed values.
220+
221+
<div class="note">
222+
As an example, in the following code fragment, when the specified value of
223+
<code>elem</code>'s 'opacity' property is updated, a user agent may defer
224+
recalculating the computed value of the 'animation' property.
225+
226+
The first time this occurs, calling {{Window/getComputedStyle(elt)}} and
227+
subsequently accessing the <code>opacity</code> property of the result will
228+
cause the user agent to recompute the value of opacity.
229+
230+
After the 'opacity' property is updated a second time, the
231+
{{Animatable/getAnimations()}} method is called on <code>elem</code>.
232+
This method is specified by Web Animations and can return {{CSSTransition}}
233+
objects as defined in this specification.
234+
Hence, as result of the requirements in this section, the user agent must apply
235+
any pending style changes thus generating a new {{CSSTransition}} for the
236+
'opacity' property before returning its result.
237+
238+
<div><pre class="example lang-javascript">
239+
elem.style.transition = 'opacity 100s';
240+
elem.style.opacity = '0';
241+
window.getComputedStyle(elem).opacity; // 0
242+
elem.style.opacity = '1';
243+
elem.getAnimations()[0].transitionProperty // 'opacity'
244+
</pre></div>
245+
246+
</div>
247+
210248
<h2 id="issues-common">Issues commonly raised as issues with previous levels</h2>
211249

212250
<p>

css-transitions-2/Overview.html

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ <h2 class="no-num no-toc no-ref heading settled" id="contents"><span class="cont
180180
<a href="#interface-dom"><span class="secno">4</span> <span class="content">DOM Interfaces</span></a>
181181
<ul class="toc">
182182
<li><a href="#the-CSSTransition-interface"><span class="secno">4.1</span> <span class="content">The CSSTransition interface</span></a>
183+
<li><a href="#requirements-on-pending-style-changes"><span class="secno">4.2</span> <span class="content">Requirements on pending style changes</span></a>
183184
</ul>
184185
<li><a href="#issues-common"><span class="secno">5</span> <span class="content">Issues commonly raised as issues with previous levels</span></a>
185186
<li><a href="#issues-spec"><span class="secno">6</span> <span class="content">Issues deferred from previous levels of the spec</span></a>
@@ -358,6 +359,33 @@ <h3 class="heading settled" data-level="4.1" id="the-CSSTransition-interface"><s
358359
as has been <a href="https://lists.w3.org/Archives/Public/www-style/2011Mar/0729.html">suggested
359360
elsewhere</a>.</p>
360361
</div>
362+
<h3 class="heading settled" data-level="4.2" id="requirements-on-pending-style-changes"><span class="secno">4.2. </span><span class="content">Requirements on pending style changes</span><a class="self-link" href="#requirements-on-pending-style-changes"></a></h3>
363+
<p>Various operations may affect the <a data-link-type="dfn" href="https://drafts.csswg.org/css-cascade-4/#computed-value">computed values</a> of
364+
properties on elements. User agents may, as an optimization, defer recomputing
365+
these values until it becomes necessary.
366+
However, all operations included in programming interface defined in this
367+
specification, as well as those operations defined in Web Animations <a data-link-type="biblio" href="#biblio-web-animations">[WEB-ANIMATIONS]</a> that may return objects defined by this specification,
368+
must produce a result consistent with having fully processed any such pending
369+
changes to computed values.</p>
370+
<div class="note" role="note">
371+
As an example, in the following code fragment, when the specified value of <code>elem</code>’s <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-color-4/#propdef-opacity">opacity</a> property is updated, a user agent may defer
372+
recalculating the computed value of the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-animations-1/#propdef-animation">animation</a> property.
373+
<p>The first time this occurs, calling <code class="idl"><a data-link-type="idl" href="https://drafts.csswg.org/cssom-1/#dom-window-getcomputedstyle">getComputedStyle(elt)</a></code> and
374+
subsequently accessing the <code>opacity</code> property of the result will
375+
cause the user agent to recompute the value of opacity.</p>
376+
<p>After the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-color-4/#propdef-opacity">opacity</a> property is updated a second time, the <code class="idl"><a data-link-type="idl" href="http://www.w3.org/TR/web-animations/#dom-animatable-getanimations">getAnimations()</a></code> method is called on <code>elem</code>.
377+
This method is specified by Web Animations and can return <code class="idl"><a data-link-type="idl" href="#csstransition">CSSTransition</a></code> objects as defined in this specification.
378+
Hence, as result of the requirements in this section, the user agent must apply
379+
any pending style changes thus generating a new <code class="idl"><a data-link-type="idl" href="#csstransition">CSSTransition</a></code> for the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-color-4/#propdef-opacity">opacity</a> property before returning its result.</p>
380+
<div>
381+
<pre class="example lang-javascript" id="example-e4db8bb0"><a class="self-link" href="#example-e4db8bb0"></a>elem.style.transition = 'opacity 100s';
382+
elem.style.opacity = '0';
383+
window.getComputedStyle(elem).opacity; // 0
384+
elem.style.opacity = '1';
385+
elem.getAnimations()[0].transitionProperty // 'opacity'
386+
</pre>
387+
</div>
388+
</div>
361389
<h2 class="heading settled" data-level="5" id="issues-common"><span class="secno">5. </span><span class="content">Issues commonly raised as issues with previous levels</span><a class="self-link" href="#issues-common"></a></h2>
362390
<p> These issues were commonly reported issues
363391
with the previous level of the specification. </p>
@@ -522,11 +550,26 @@ <h3 class="no-num heading settled" id="index-defined-here"><span class="content"
522550
</ul>
523551
<h3 class="no-num heading settled" id="index-defined-elsewhere"><span class="content">Terms defined by reference</span><a class="self-link" href="#index-defined-elsewhere"></a></h3>
524552
<ul class="indexlist">
553+
<li>
554+
<a data-link-type="biblio" href="#biblio-css-animations-1">[css-animations-1]</a> defines the following terms:
555+
<ul>
556+
<li><a href="https://drafts.csswg.org/css-animations-1/#propdef-animation">animation</a>
557+
</ul>
525558
<li>
526559
<a data-link-type="biblio" href="#biblio-css-backgrounds-3">[css-backgrounds-3]</a> defines the following terms:
527560
<ul>
528561
<li><a href="https://drafts.csswg.org/css-backgrounds-3/#border-left-width">border-left-width</a>
529562
</ul>
563+
<li>
564+
<a data-link-type="biblio" href="#biblio-css-cascade-4">[css-cascade-4]</a> defines the following terms:
565+
<ul>
566+
<li><a href="https://drafts.csswg.org/css-cascade-4/#computed-value">computed value</a>
567+
</ul>
568+
<li>
569+
<a data-link-type="biblio" href="#biblio-css-color-4">[css-color-4]</a> defines the following terms:
570+
<ul>
571+
<li><a href="https://drafts.csswg.org/css-color-4/#propdef-opacity">opacity</a>
572+
</ul>
530573
<li>
531574
<a data-link-type="biblio" href="#biblio-css-transitions-1">[css-transitions-1]</a> defines the following terms:
532575
<ul>
@@ -536,6 +579,11 @@ <h3 class="no-num heading settled" id="index-defined-elsewhere"><span class="con
536579
<li><a href="https://drafts.csswg.org/css-transitions-1/#style-change-event">style change event</a>
537580
<li><a href="https://drafts.csswg.org/css-transitions-1/#propdef-transition-property">transition-property</a>
538581
</ul>
582+
<li>
583+
<a data-link-type="biblio" href="#biblio-cssom-1">[cssom]</a> defines the following terms:
584+
<ul>
585+
<li><a href="https://drafts.csswg.org/cssom-1/#dom-window-getcomputedstyle">getComputedStyle(elt)</a>
586+
</ul>
539587
<li>
540588
<a data-link-type="biblio" href="#biblio-dom-ls">[dom-ls]</a> defines the following terms:
541589
<ul>
@@ -556,6 +604,7 @@ <h3 class="no-num heading settled" id="index-defined-elsewhere"><span class="con
556604
<li><a href="http://www.w3.org/TR/web-animations/#animatable">Animatable</a>
557605
<li><a href="http://www.w3.org/TR/web-animations/#animationtimeline">AnimationTimeline</a>
558606
<li><a href="http://www.w3.org/TR/web-animations/#dictdef-keyframeeffectoptions">KeyframeEffectOptions</a>
607+
<li><a href="http://www.w3.org/TR/web-animations/#dom-animatable-getanimations">getAnimations()</a>
559608
</ul>
560609
<li>
561610
<a data-link-type="biblio" href="#biblio-webidl">[WebIDL]</a> defines the following terms:
@@ -568,12 +617,20 @@ <h3 class="no-num heading settled" id="normative"><span class="content">Normativ
568617
<dl>
569618
<dt id="biblio-webidl"><a class="self-link" href="#biblio-webidl"></a>[WebIDL]
570619
<dd>Cameron McCormack; Boris Zbarsky. <a href="http://www.w3.org/TR/WebIDL-1/">WebIDL Level 1</a>. 4 August 2015. WD. URL: <a href="http://www.w3.org/TR/WebIDL-1/">http://www.w3.org/TR/WebIDL-1/</a>
620+
<dt id="biblio-css-animations-1"><a class="self-link" href="#biblio-css-animations-1"></a>[CSS-ANIMATIONS-1]
621+
<dd>CSS Animations Module Level 1 URL: <a href="http://www.w3.org/TR/css3-animations/">http://www.w3.org/TR/css3-animations/</a>
571622
<dt id="biblio-css-backgrounds-3"><a class="self-link" href="#biblio-css-backgrounds-3"></a>[CSS-BACKGROUNDS-3]
572623
<dd>CSS Backgrounds and Borders Module Level 3 URL: <a href="http://www.w3.org/TR/css3-background/">http://www.w3.org/TR/css3-background/</a>
624+
<dt id="biblio-css-cascade-4"><a class="self-link" href="#biblio-css-cascade-4"></a>[CSS-CASCADE-4]
625+
<dd>Elika Etemad; Tab Atkins Jr.. <a href="http://www.w3.org/TR/css-cascade-4/">CSS Cascading and Inheritance Level 4</a>. 8 September 2015. WD. URL: <a href="http://www.w3.org/TR/css-cascade-4/">http://www.w3.org/TR/css-cascade-4/</a>
626+
<dt id="biblio-css-color-4"><a class="self-link" href="#biblio-css-color-4"></a>[CSS-COLOR-4]
627+
<dd>CSS Color Module Level 4 URL: <a href="https://drafts.csswg.org/css-color-4/">https://drafts.csswg.org/css-color-4/</a>
573628
<dt id="biblio-css-transitions-1"><a class="self-link" href="#biblio-css-transitions-1"></a>[CSS-TRANSITIONS-1]
574629
<dd>CSS Transitions Module Level 1 URL: <a href="http://www.w3.org/TR/css3-transitions/">http://www.w3.org/TR/css3-transitions/</a>
575630
<dt id="biblio-css3-transitions"><a class="self-link" href="#biblio-css3-transitions"></a>[CSS3-TRANSITIONS]
576631
<dd>Dean Jackson; et al. <a href="http://www.w3.org/TR/css3-transitions/">CSS Transitions</a>. 19 November 2013. WD. URL: <a href="http://www.w3.org/TR/css3-transitions/">http://www.w3.org/TR/css3-transitions/</a>
632+
<dt id="biblio-cssom"><a class="self-link" href="#biblio-cssom"></a>[CSSOM]
633+
<dd>Simon Pieters; Glenn Adams. <a href="http://www.w3.org/TR/cssom/">CSS Object Model (CSSOM)</a>. 5 December 2013. WD. URL: <a href="http://www.w3.org/TR/cssom/">http://www.w3.org/TR/cssom/</a>
577634
<dt id="biblio-dom-ls"><a class="self-link" href="#biblio-dom-ls"></a>[DOM-LS]
578635
<dd>Document Object Model URL: <a href="https://dom.spec.whatwg.org/">https://dom.spec.whatwg.org/</a>
579636
<dt id="biblio-rfc2119"><a class="self-link" href="#biblio-rfc2119"></a>[RFC2119]

0 commit comments

Comments
 (0)