[html5] r6582 - [e] (0) Explain why browsers shouldn't give up and should block scripts on style [...]

whatwg at whatwg.org whatwg at whatwg.org
Fri Sep 23 15:29:10 PDT 2011


Author: ianh
Date: 2011-09-23 15:29:08 -0700 (Fri, 23 Sep 2011)
New Revision: 6582

Modified:
   complete.html
   index
   source
Log:
[e] (0) Explain why browsers shouldn't give up and should block scripts on style sheets even though they don't have to.

Modified: complete.html
===================================================================
--- complete.html	2011-09-23 22:20:31 UTC (rev 6581)
+++ complete.html	2011-09-23 22:29:08 UTC (rev 6582)
@@ -15147,6 +15147,19 @@
   and the user agent hasn't given up on that particular style sheet
   yet. A user agent may give up on a style sheet at any time.</p>
 
+  <p class=note>Giving up on a style sheet before the style sheet
+  loads, if the style sheet eventually does still load, means that the
+  script might end up operating with incorrect information. For
+  example, if a style sheet sets the color of an element to green, but
+  a script that inspects the resulting style is executed before the
+  sheet is loaded, the script will find that the element is black (or
+  whatever the default color is), and might thus make poor choices
+  (e.g. deciding to use black as the color elsewhere on the page,
+  instead of green). Implementors have to balance the likelihood of a
+  script using incorrect information with the performance impact of
+  doing nothing while waiting for a slow network request to
+  finish.</p>
+
   <p>A <code><a href=#document>Document</a></code> <dfn id=has-a-style-sheet-that-is-blocking-scripts>has a style sheet that is blocking
   scripts</dfn> if there is either <a href=#a-style-sheet-that-is-blocking-scripts>a style sheet that is
   blocking scripts</a> in the context of that

Modified: index
===================================================================
--- index	2011-09-23 22:20:31 UTC (rev 6581)
+++ index	2011-09-23 22:29:08 UTC (rev 6582)
@@ -15011,6 +15011,19 @@
   and the user agent hasn't given up on that particular style sheet
   yet. A user agent may give up on a style sheet at any time.</p>
 
+  <p class=note>Giving up on a style sheet before the style sheet
+  loads, if the style sheet eventually does still load, means that the
+  script might end up operating with incorrect information. For
+  example, if a style sheet sets the color of an element to green, but
+  a script that inspects the resulting style is executed before the
+  sheet is loaded, the script will find that the element is black (or
+  whatever the default color is), and might thus make poor choices
+  (e.g. deciding to use black as the color elsewhere on the page,
+  instead of green). Implementors have to balance the likelihood of a
+  script using incorrect information with the performance impact of
+  doing nothing while waiting for a slow network request to
+  finish.</p>
+
   <p>A <code><a href=#document>Document</a></code> <dfn id=has-a-style-sheet-that-is-blocking-scripts>has a style sheet that is blocking
   scripts</dfn> if there is either <a href=#a-style-sheet-that-is-blocking-scripts>a style sheet that is
   blocking scripts</a> in the context of that

Modified: source
===================================================================
--- source	2011-09-23 22:20:31 UTC (rev 6581)
+++ source	2011-09-23 22:29:08 UTC (rev 6582)
@@ -16043,6 +16043,19 @@
   and the user agent hasn't given up on that particular style sheet
   yet. A user agent may give up on a style sheet at any time.</p>
 
+  <p class="note">Giving up on a style sheet before the style sheet
+  loads, if the style sheet eventually does still load, means that the
+  script might end up operating with incorrect information. For
+  example, if a style sheet sets the color of an element to green, but
+  a script that inspects the resulting style is executed before the
+  sheet is loaded, the script will find that the element is black (or
+  whatever the default color is), and might thus make poor choices
+  (e.g. deciding to use black as the color elsewhere on the page,
+  instead of green). Implementors have to balance the likelihood of a
+  script using incorrect information with the performance impact of
+  doing nothing while waiting for a slow network request to
+  finish.</p>
+
   <p>A <code>Document</code> <dfn>has a style sheet that is blocking
   scripts</dfn> if there is either <span>a style sheet that is
   blocking scripts</span> in the context of that




More information about the Commit-Watchers mailing list