Skip to content

Commit

Permalink
Allow UAs to conditionally block on stylesheet loading
Browse files Browse the repository at this point in the history
In particular, if the media attribute doesn't match the environment there's no need to block on it.

Fixes #2886.
  • Loading branch information
domfarolino authored and annevk committed Jan 12, 2018
1 parent d3f65d2 commit 42dd707
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -15082,15 +15082,30 @@ interface <dfn>HTMLStyleElement</dfn> : <span>HTMLElement</span> {
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 the
element was created by that <code>Document</code>'s parser, and the element is either a
<code>style</code> element or a <code>link</code> element that was an <span
data-x="rel-stylesheet">external resource link that contributes to the styling processing
model</span> when the element was created by the parser, and the element's style sheet was enabled
when the element was created by the parser, and the element's <span>style sheet ready</span> flag
is not yet set, and, 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>, 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>
<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>

<li><p>The element is either a <code>style</code> element or a <code>link</code> element that was
an <span data-x="rel-stylesheet">external resource link that contributes to the styling
processing model</span> when the element was created by the parser.</p></li>

<li><p>If the element is a <code>link</code> element, it's <code
data-x="attr-link-media">media</code> attribute's value <span>matches the
environment</span>.</p></li>

<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 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>

<li><p>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></li>
</ul>

<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
Expand Down

0 comments on commit 42dd707

Please sign in to comment.