-
Notifications
You must be signed in to change notification settings - Fork 23.1k
Description
MDN URL
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/lang
What specific section or headline is this issue about?
"Note: The default value of lang is the empty string, which means that the language is unknown."
What information was incorrect, unhelpful, or incomplete?
"Note: The default value of lang is the empty string,"
What did you expect to see?
Either this statement being removed, or it expanded to be more accurate.
Do you have any supporting links, references, or citations?
https://html.spec.whatwg.org/multipage/dom.html#language
Do you have anything more you want to share?
Notes on why the statement is incorrect:
https://html.spec.whatwg.org/multipage/dom.html#language has the details, and it is conditioned on whether the attribute is set. (which means the attribute being set to the empty string vs. being unset are semantically different)
If the lang attribute is explicitly set to the empty string, then the spec says that the language is explicitly unknown per [1].
But when when the lang attribute is not set on an element, then the spec defines a variety of other sources that browsers should use to establish the language (including the element's parent node, or shadow root, or "a pragma-set default language", or language information from another involved protocol like from an HTTP header.
[1] Here's the spec text that says an explicit empty-string value results in the language being explicitly-unknown:
To determine the language of a node, user agents must use the first appropriate step in the following list:
[...]
- If the node is an HTML element or an element in the SVG namespace, and it has a lang in no namespace attribute set
Use the value of that attribute.
[...]
If the resulting value is the empty string, then it must be interpreted as meaning that the language of the node is explicitly unknown.
It looks like this note was last modified in #32604 / 1a84803 which replaced another bit of incorrect information ("The default value of lang is unknown"), but the replacement about the empty string is also incorrect.
MDN metadata
Page report details
- Folder:
en-us/web/html/reference/global_attributes/lang - MDN URL: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/lang
- GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/web/html/reference/global_attributes/lang/index.md
- Last commit: 0754cd8
- Document last modified: 2025-07-09T21:49:04.000Z