- Notifications
You must be signed in to change notification settings - Fork2.9k
Document render blocking with a <link rel=expect> element#9970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
4cd42e8
44f212a
e03fe95
745e1ff
8469cc6
6400b52
e053141
13f8fd6
d70a7a0
0a7f0ae
d701641
ab0a4fb
8ab3a90
3d81086
4eb3251
ec278ec
f2f7071
3f1e9ac
a0ab1dd
435c97c
c1652a8
1bacd54
dc919fa
b89e0ad
80bf0d3
6a9d5b2
f5bae82
53f8aa5
c88bce2
ac5a66f
d7bc03a
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -26328,8 +26328,8 @@ document.body.appendChild(wbr);</code></pre> | ||
<h5>Link type "<dfn attr-value for="link/rel"><code data-x="rel-expect">expect</code></dfn>"</h5> | ||
<p>The <code data-x="rel-expect">expect</code> keyword may be used with <code>link</code | ||
elements.</p> | ||
<p>The <code data-x="rel-expect">expect</code> keyword indicates that an element with a certain | ||
<span data-x="concept-id">ID</span> is expected in this document, and the link might | ||
@@ -26342,16 +26342,18 @@ document.body.appendChild(wbr);</code></pre> | ||
following are true:</p> | ||
domenic marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
domenic marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
<ul class="brief"> | ||
<li><p><var>el</var> is <span>browsing-context connected</span>;</p></li> | ||
noamr marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
<li><p><var>el</var>'s <code data-x="attr-link-media">media</code> attribute | ||
<span>matches the environment</span>;</p></li> | ||
<li><p><var>el</var>'s <code data-x="attr-link-href">href</code> attribute | ||
starts with the "#" character (U+0023 NUMBER SIGN) followed by a non-empty | ||
<span>URL-fragment string</span>;</p></li> | ||
domenic marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
</ul> | ||
<p>then <span>block rendering</span> on <var>el</var>; Otherwise, <span>unblock rendering</span> | ||
domenic marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
on<var>el</var>.</p> | ||
noamr marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
noamr marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. From implementation perspective, this may be hard to realize because we need to know which environment can change to satisfy or not satisfy a media value. We also need to be future proof about this. Is there a precedence in the spec for re-checking media attribute if the environment changes? IMHO the ideal think would be to define specific points at which the media attribute is checked (e.g. for rel=expect, when the link element is parsed/encountered) and make the decision whether it applies at that time. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. That's how all existing media attributes work? E.g. viewport width media queries, dark mode... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. This is not different from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more.
I'm trying to find a place where that's spelled out in the spec, do you have a link? The best I can find in rel=stylesheet fetch setup steps is
The only other place I can see is inhttps://html.spec.whatwg.org/#processing-the-media-attribute (which btw, needs to updated in this PR):
This is a bit ambiguous. One can read that as "check if media matches the environment when you're about to apply the resource". I'm not sure the interpretation of "anytime environment changes, recheck all media attributes" is clear here. What is the correct reading of this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more.
Likewise here, the only relevant text I can find is inhttps://html.spec.whatwg.org/#link-type-preload
This says
not when the environment itself changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Removed it as a requirement and added a note instead There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I guess this is just a victim of the general under-specification of link processing, indeed.. I don't understand the new note though. The normative text says that when There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. The note is about the environment changing without media changing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. For stylesheets, the handling of environment changes for the CSSOM View defines when the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I'm unsure where this discussion leaves us but I personally am content with what's currently written because this area feels like an existing problem.@zcorpan, if you have any concerns or concrete suggestions, please let us know. | ||
<p>The appropriate times to <span>process <code data-x="rel-expect">expect</code> link</span> | ||
are:</p> | ||
@@ -26368,7 +26370,7 @@ document.body.appendChild(wbr);</code></pre> | ||
data-x="rel-expect">expect</code>.</p></li> | ||
<li><p>When the environment changes or the link's <code data-x="attr-link-media">media</code> | ||
noamr marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
attribute or the environment change.</span></p></li> | ||
</ul> | ||
<p>To <dfn>resolve <code data-x="rel-expect">expect</code> links</dfn> given a | ||
@@ -26382,7 +26384,7 @@ document.body.appendChild(wbr);</code></pre> | ||
domenic marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
<p>To <dfn>unblock on all expected elements</dfn> given a <code>Document</code> | ||
<var>doc</var>, <span>resolve <code data-x="rel-expect">expect</code> links</span> given | ||
<var>doc</var> and true.</p> | ||
noamr marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
domenic marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
<p>To <dfn>potentially unblock on expected element</dfn> <var>el</var>: If <var>el</var>'s <span | ||
data-x="concept-id">ID</span> is set, then <span>resolve <code | ||
noamr marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
@@ -26396,7 +26398,7 @@ document.body.appendChild(wbr);</code></pre> | ||
<li><p>Assert: <var>expectedURL</var> <span data-x="concept-url-equals">equals</span> | ||
<var>link</var>'s <span>node document</span>'s <span data-x="concept-document-url">URL</span> | ||
with <i data-x="url equals exclude fragments">exclude fragments</i> set to true.</p></li> | ||
noamr marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
<li><p>Return true if <var>expectedURL</var>'s <span | ||
data-x="concept-url-fragment">fragment</span> is <var>el</var>'s <span | ||
@@ -26405,7 +26407,7 @@ document.body.appendChild(wbr);</code></pre> | ||
<p>When any element <var>el</var> is <span>browsing-context connected</span>, if <var>el</var> is | ||
not on the <span>stack of open elements</span> of an <span>HTML parser</span>, then | ||
<span>potentially unblock on expected element</span> given <var>el</var>.</p> | ||