Skip to content

Add <meta name="responsive-embedded-sizing">#12444

Open
kojiishi wants to merge 1 commit into
whatwg:mainfrom
kojiishi:responsive-embedded-sizing
Open

Add <meta name="responsive-embedded-sizing">#12444
kojiishi wants to merge 1 commit into
whatwg:mainfrom
kojiishi:responsive-embedded-sizing

Conversation

@kojiishi
Copy link
Copy Markdown

@kojiishi kojiishi commented May 13, 2026

This adds <meta name="responsive-embedded-sizing"> as an immutable standardized name.

This is used by the CSS responsive embedded sizing flag.

(See WHATWG Working Mode: Changes for more details.)


/dom.html ( diff )
/semantics.html ( diff )

@kojiishi
Copy link
Copy Markdown
Author

@mtrootyy
Copy link
Copy Markdown

If either name, http-equiv, or itemprop is specified in meta element, then the content attribute must also be specified.
If "responsive-embedded-sizing" is specified to value of name attribute of mata element, what is specfied to value of content attribute of this meta element?

@miketaylr
Copy link
Copy Markdown
Member

https://html.spec.whatwg.org/#the-meta-element

If either name, http-equiv, or itemprop is specified, then the content attribute must also be specified. Otherwise, it must be omitted.

But just below:

If a meta element has a name attribute, it sets document metadata.... If a meta element has no content attribute, then the value part of the metadata name-value pair is the empty string.

So meta with name and without content is allowed (but, imho it's a bit confusing for HTML to use must in "this must be specified, otherwise it must not be specified" instead of may?)

@mtrootyy
Copy link
Copy Markdown

mtrootyy commented May 18, 2026

If a meta element has no content attribute, then the value part of the metadata name-value pair is the empty string.

The above specifications are for user agents, not for authors.
Regardless of how the user agent processes it, author must comply with the following specifications.

If either name, http-equiv, or itemprop is specified, then the content attribute must also be specified.

Comment thread source Outdated
the user agent must run the following algorithm:</p>

<ol>
<li><p>If <var>element</var> is not inserted by the parser, then return.</p></li>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This doesn't seem like a good idea. This will just encourage people to use document.write() instead of tree manipulation.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggesting an alternative where once the body element is seen this cannot be modified.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That's also not a primitive that exists?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It is, eg for render blocking.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

A similar approach is to cement it at the beginning of the first render

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@noamr

This is different, I mean that you can't apply it once the body is seen, even if it's inserted to the head

Can you expand a bit more? It looks to me that if it's valid only in <head>, and only by the parser, then you can't insert to the head once the body is seen, so we're talking about the same thing. Did I miss anything?

For b and c, The best way to spec this I think is to have this as a tri state of sorts (true, false, uninitialized) and set it to false on some conditions (eg body insertion). Not sure if parser-inserted is that important given the other conditions or what the best way to spec it given document.write().

I was worried "hey, it's alredy defined there, use existing definition" feedback, so I'm fine with your suggestion if that is preferred.

Two questions before I update this PR. I couldn't read whether you and @annevk want to allow tree manipulation or not, and whether to allow document.write(), when the script is in <head>. Could you clarify which you want?

@annevk previously requested this to be immutable, so I'm trying to respond to the request. My understanding of the "immutable" is not allowing tree manipulation nor document.write() even in <head>, but I'm happy to be corrected if that was wrong.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Three questions actually, sorry. Custom elements could inject a <meta> element asynchronously. Do we want to allow that?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@noamr

This is different, I mean that you can't apply it once the body is seen, even if it's inserted to the head

Can you expand a bit more? It looks to me that if it's valid only in <head>, and only by the parser, then you can't insert to the head once the body is seen, so we're talking about the same thing. Did I miss anything?

It's almost the same but not exactly. What I am suggesting still allows inserting it dynamically in a parser blocking script included in the head. It's a more established concept than "only by the parser" and I think it might do in terms of security etc. it's equivalent behavior to the blocking attribute - which can make some sense given that they both impact rendering behavior.

For b and c, The best way to spec this I think is to have this as a tri state of sorts (true, false, uninitialized) and set it to false on some conditions (eg body insertion). Not sure if parser-inserted is that important given the other conditions or what the best way to spec it given document.write().

I was worried "hey, it's alredy defined there, use existing definition" feedback, so I'm fine with your suggestion if that is preferred.

Two questions before I update this PR. I couldn't read whether you and @annevk want to allow tree manipulation or not, and whether to allow document.write(), when the script is in <head>. Could you clarify which you want?

@annevk previously requested this to be immutable, so I'm trying to respond to the request. My understanding of the "immutable" is not allowing tree manipulation nor document.write() even in <head>, but I'm happy to be corrected if that was wrong.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks a lot for the clarification @noamr. So you want to allow tree manipulations, document.write(), and async custom elements injections, as long as they're done before <body> starts. /cc @tabatkins @bfgeek

@annevk can you confirm if you agree this achieves "immutable"?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks a lot for the clarification @noamr. So you want to allow tree manipulations, document.write(), and async custom elements injections, as long as they're done before <body> starts. /cc @tabatkins @bfgeek

Yes but only for the first time (when uninitialized)
So you can document.write or append the meta, but only if it wasn't already there and only if the body didn't start yet.

@kojiishi
Copy link
Copy Markdown
Author

@annevk can you help whether the content attribute is required or not? It looks to me that omitting is allowed from what @miketaylr quoted, but I'm not sure.

@mtrootyy wrote:

If a meta element has no content attribute, then the value part of the metadata name-value pair is the empty string.

The above specifications are for user agents, not for authors. Regardless of how the user agent processes it, author must comply with the following specifications.

If either name, http-equiv, or itemprop is specified, then the content attribute must also be specified.

@kojiishi kojiishi force-pushed the responsive-embedded-sizing branch from 5d63e86 to ad98ae3 Compare May 28, 2026 08:51
Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
@kojiishi kojiishi force-pushed the responsive-embedded-sizing branch from ad98ae3 to 49c5445 Compare May 28, 2026 16:22
Comment thread source Outdated
<p>Each <code>Document</code> has a boolean
<dfn data-x="concept-document-responsive-embedded-sizing">responsive embedded sizing</dfn>,
initially false.</p>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@kojiishi this is what I mean by "move things around"
The note below this ("as the name indicates") relates to the paragraph about "navigation ID or webdriver Bidi", and the new paragraph splits them in the middle.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I got it, thanks for the explanation and thanks for catching this. Done.

@kojiishi kojiishi force-pushed the responsive-embedded-sizing branch from 49c5445 to fe4fc74 Compare May 28, 2026 16:56
This adds `<meta name="responsive-embedded-sizing">` as an immutable standardized name.

This is used by the CSS [responsive embedded sizing flag].

[responsive embedded sizing flag]: https://drafts.csswg.org/css-sizing-4/#document-responsive-embedded-sizing-flag
@kojiishi kojiishi force-pushed the responsive-embedded-sizing branch from fe4fc74 to 615fb1c Compare May 28, 2026 17:34
Copy link
Copy Markdown
Collaborator

@noamr noamr left a comment

Choose a reason for hiding this comment

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

(Unofficial as I'm not an approver and we need multi implementer support)
I think this PR does the right thing in a way that's concise and consistent enough.
Editorially I can't say about maintaining the outdated wording style of existing meta tag or moving forward.

Comment thread source
<div algorithm>
<p>If a <code>meta</code> element is
<span data-x="node is inserted into a document">inserted into the document</span>,
the user agent must run the following algorithm:</p>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this wording style is outdated but will leave to @annevk whether this needs to be consistent with what's around it or with new style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants