Skip to content

Commit

Permalink
Start working on style sheet done flag
Browse files Browse the repository at this point in the history
  • Loading branch information
domfarolino committed Sep 25, 2018
1 parent 6fbb7ff commit e217ef0
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -15169,19 +15169,27 @@ interface <dfn>HTMLStyleElement</dfn> : <span>HTMLElement</span> {

<h4>Interactions of styling and scripting</h4>

<p>Style sheets, whether added by a <code>link</code> element, a <code>style</code> element, an
<code>&lt;?xml-stylesheet?></code> PI, an HTTP `<code data-x="http-link">Link</code>` header, or
some other mechanism, have a <dfn>style sheet ready</dfn> flag, which is initially unset.</p>

<p>When a style sheet is ready to be applied, its <span>style sheet ready</span> flag must be set.
If the style sheet referenced no other resources (e.g. it was an internal style sheet given by a
<code>style</code> element with no <code data-x="">@import</code> rules), then the style rules must
be <span>immediately</span> made available to script; otherwise, the style rules must only be made available
to script once the <span>event loop</span> reaches its <span>update the rendering</span> step.</p>

<p>A style sheet in the context of the <code>Document</code> of an <span>HTML parser</span> or
<span>XML parser</span> is said to be <dfn>a style sheet that is blocking scripts</dfn> if all of
the following conditions occur:</p>
<p><span data-x="CSS style sheet">Style sheets</span>, whether added by a <code>link</code>
element, a <code>style</code> element, an <code>&lt;?xml-stylesheet?></code> PI, an HTTP
`<code data-x="http-link">Link</code>` header, or some other mechanism, have a <dfn>style sheet
done</dfn> flag, which is initially unset. When a style sheet is ready to be applied, its
<span>style sheet done</span> flag must be set.</p>

<p class="note">The <span>style sheet done</span> flag is used to indicate when a style sheet has
been obtained, if necessary, and is ready to be applied. The purpose of this is to make <span>a
style sheet that is blocking scripts</span> no longer a style sheet of this category, so that
scripting is no longer blocked. The algorithm that creates and applies the style sheet is
responsible for setting this flag.</p>

If the <span data-x="CSS style sheet">style sheet</span> referenced no other resources (e.g.,
it was an internal style sheet given by a <code>style</code> element with no
<code data-x="">@import</code> rules), then the style rules must be <span>immediately</span> made
available to script; otherwise, the style rules must only be made available to script once the
<span>event loop</span> reaches its <span>update the rendering</span> step.

<p>A <span data-x="CSS style sheet">style sheet</span> in the context of the <code>Document</code>
of an <span>HTML parser</span> or <span>XML parser</span> is said to be <dfn>a style sheet that is
blocking scripts</dfn> if all of the following conditions occur:</p>

<ul>
<li><p>The element was created by that <code>Document</code>'s parser.</p></li>
Expand All @@ -15196,7 +15204,7 @@ interface <dfn>HTMLStyleElement</dfn> : <span>HTMLElement</span> {

<li><p>The element's style sheet was enabled when the element was created by the parser.</p></li>

<li><p>The element's <span>style sheet ready</span> flag is not yet set.</p></li>
<li><p>The element's <span>style sheet done</span> flag is not yet set.</p></li>

<li><p>The last time the <span>event loop</span> reached <a href="#step1">step 1</a>, the
element's <span>root</span> was that <code>Document</code>.</p></li>
Expand All @@ -15210,7 +15218,7 @@ interface <dfn>HTMLStyleElement</dfn> : <span>HTMLElement</span> {
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
(e.g., deciding to use black as the color elsewhere on the page, instead of green). Implementers
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>

Expand Down Expand Up @@ -24599,7 +24607,8 @@ document.body.appendChild(wbr);</code></pre>
link</span> that contributes to the styling processing model. This keyword is
<span>body-ok</span>.</p>

<p>The specified resource is a CSS style sheet that describes how to present the document.</p>
<p>The specified resource is a <span>CSS style sheet</span> that describes how to present the
document.</p>

<p>If the <code data-x="rel-alternate">alternate</code> keyword is also specified on the
<code>link</code> element, then <dfn id="the-link-is-an-alternative-stylesheet">the link is an
Expand Down

0 comments on commit e217ef0

Please sign in to comment.