Skip to content

Clarify requirements for render-blocking #39809

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

eeeps
Copy link
Contributor

@eeeps eeeps commented Jun 5, 2025

Description

Clarify requirements for render-blocking. Also make clear that we are not only blocking on fetching; also on parsing/application.

Motivation

I was caught out when trying to implement render-blocking, because I did not understand from either MDN or reading the spec that scripts with blocking="render" needed to appear in the head. This started a series of conversations with @noamr and @zcorpan about what render-blocking needs (and what needs render-blocking) which I am trying to capture in this PR.

Additional details

(see linked spec reference and Bluesky link in #39663).

I'm not sure these notes need to be in all of these places, but figured that removing them would be easier for reviewers than finding all of the places they could/should be.

Related issues and pull requests

Fixes #39663

Fixes mdn#39663

Also make clear that we are not only blocking on fetching; also on parsing/application.
@eeeps eeeps requested review from a team as code owners June 5, 2025 18:38
@eeeps eeeps requested review from dipikabh and sideshowbarker and removed request for a team June 5, 2025 18:38
@github-actions github-actions bot added Content:HTML Hypertext Markup Language docs Content:WebAPI Web API docs size/m [PR only] 51-500 LoC changed labels Jun 5, 2025

To ensure that your initial HTML has been parsed and will always render consistently before the transition animation runs, you can use [`<link rel="expect">`](/en-US/docs/Web/HTML/Reference/Attributes/rel#expect). In this element, you include the following attributes:

- `rel="expect"` to indicate that you want to use this `<link>` element to render block some HTML on the page.
- `href="#element-id"` to indicate the ID of the element you want to render block.
- `blocking="render"` to render block the specified HTML.

> [!NOTE]
> In order to block rendering, `script`, `link`, and `style` elements with `blocking="render"` must be in the `head` of the document.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... and present before the <body> element is parsed.

Adding an element to the <head>after <body> is parsed cannot block rendering.

@dipikabh
Copy link
Contributor

Hi @eeeps, thanks for these updates!
I've suggested a rephrasing that I hope helps to address Noam's comment. Please ping if you need any help with getting this PR over the finish line.

@sideshowbarker sideshowbarker removed their request for review June 19, 2025 01:48
Copy link
Contributor

This pull request has merge conflicts that must be resolved before it can be merged.

@github-actions github-actions bot added the merge conflicts 🚧 [PR only] label Jun 23, 2025
@bsmth bsmth added the awaiting response Awaiting for author to address review/feedback label Jul 17, 2025
@Josh-Cena
Copy link
Member

Josh-Cena commented Jul 27, 2025

@dipikabh Given it has been a month, perhaps we can move forward by applying any changes ourselves.

(Also pinging @eeeps once more for attention)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting response Awaiting for author to address review/feedback Content:HTML Hypertext Markup Language docs Content:WebAPI Web API docs merge conflicts 🚧 [PR only] size/m [PR only] 51-500 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Elements with blocking=render have to be in the <head>
5 participants