-
Notifications
You must be signed in to change notification settings - Fork 22.5k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document blocking attribute for link,script,style elements #14648
Conversation
Thanks! I think we should wait for an implementation before merging this. Implementation can get stalled. What about making this a draft PR meanwhile? |
Preview URLs
Flaws (1)Note! 2 documents with no flaws that don't need to be listed. 🎉 URL:
(comment last updated: 2022-11-30 15:12:58) |
@@ -34,6 +34,9 @@ This element includes the [global attributes](/en-US/docs/Web/HTML/Global_attrib | |||
- : A cryptographic nonce (number used once) used to allow inline styles in a [style-src Content-Security-Policy](/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide a nonce that cannot be guessed as bypassing a resource's policy is otherwise trivial. | |||
- {{htmlattrdef("title")}} | |||
- : This attribute specifies [alternative style sheet](/en-US/docs/Web/CSS/Alternative_style_sheets) sets. | |||
- {{htmlattrdef("blocking")}} | |||
- : This attribute explicitly indicates that certain operations should be blocked on the fetching of the script. The operations that are to be blocked must be a space-separated list of blocking attributes listed below. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"script" doesn't seem correct here. It would be good to clarify if renderring will be blocked on subresources loading like background-image: url(…)
or @import
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll update it as ..certain operations should be blocked on the fetching of external resources
. Would that be better?
I do believe that subresource loading inside the <style> tag does block rendering.
@xiaochengh if you could maybe clarify, I'll promptly update the doc based on the clarification. Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we talking about the attribute on the <style> element here?
For <style>, as per spec, rendering will be blocked on the "critical subresources", i.e. the subresources blocking the load
event of the element. Current browsers generally only consider @import
-ed stylesheets as critical subresources. Fonts and background images are not critical subresources.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @xiaochengh
Are we talking about the attribute on the <style> element here?
Yes
@mnoorenberghe I have updated the docs to mention the cases of background-image: url(…)
and @import
and fonts
d3a7cfd
to
f3bbb46
Compare
f3bbb46
to
83537c7
Compare
Per https://chromium.googlesource.com/chromium/src/+/f94b3a1c0ed4505190de7c149d6330600589a995 this seems to have shipped in Chrome 105 in August — so I’ve gone ahead and flipped it from Draft back to Review for Review. Is there anything else we’re waiting on in order to merge this? @mnoorenberghe Should we consider #14648 (review) to be resolved? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should land this.
Don't we need to also add browser compat data for this? |
Yes, that would be good. Do you want to create a PR? |
* Document blocking attribute for link,script,style tag * Appease the markdown linter * Apply suggestions from code review Co-authored-by: Brian Thomas Smith <[email protected]> Co-authored-by: Michael[tm] Smith <[email protected]> Co-authored-by: Florian Scholz <[email protected]>
Summary
Document the
blocking
attribute onscript
,link
andstyle
HTML elements and basic examples for how to use it.Motivation
The attribute was added to HTML spec in whatwg/html#7474
Supporting details
Explainer for the added attribute : whatwg/html#7131
Related issues
Fix #12900
Metadata