This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 26971 - Under the https://html.spec.whatwg.org/#title-on-style: "...the user agent must queue a task to inv [...]
Summary: Under the https://html.spec.whatwg.org/#title-on-style: "...the user agent m...
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: https://html.spec.whatwg.org/#title-o...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-04 15:59 UTC by contributor
Modified: 2014-10-14 21:54 UTC (History)
2 users (show)

See Also:


Attachments

Description contributor 2014-10-04 15:59:37 UTC
Specification: https://html.spec.whatwg.org/
Multipage: https://html.spec.whatwg.org/multipage/#title-on-style
Complete: https://html.spec.whatwg.org/#title-on-style
Referrer: 

Comment:
Under the https://html.spec.whatwg.org/#title-on-style:  "...the user agent
must queue a task to invoke the update a style block algorithm"  for the case
when one of the child nodes of the STYLE element is modified by a script, and
this script then attempts to access modified style data - it will not be
available  to the script because the "update a style block" algorithm has not
been run at this point (it has been queued)  It appears that the browsers
don't queue "update a style block" algorithm, but run it immediately after any
change has been made to the contents of the STYLE element (see
WebKit/Source/WebCore/html/HTMLStyleElement::childrenChanged)  Example: 
<style id="s"></style> <div id="d"></div> <script type="text/javascript">   
var s=document.getElementById("s");    s.textContent="#d
{background-color:rgb(1, 2, 3);}";    var d=document.getElementById("d");   
var c=getComputedStyle(d).backgroundColor;    // in IE, XulRunner, WebKit at
this point "c" will be equal to "rgb(1, 2, 3)", which makes sense.    //
however, if implemented according to the spec, "c" will be "transparent" - the
default value,	   // because the changes to the contents of the style element
will be applied only	 // after the current script has completed </script> 
Solution:  change the phrase to: "...the user agent must run a task to invoke
the update a style block algorithm" 

Posted from: 94.75.209.155
User agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0
Comment 1 contributor 2014-10-14 21:54:11 UTC
Checked in as WHATWG revision r8838.
Check-in comment: Changes to a CSS style sheet take effect immediately
https://html5.org/tools/web-apps-tracker?from=8837&to=8838