Skip to content

Commit

Permalink
Add lang="" to <html>
Browse files Browse the repository at this point in the history
In the past we decided¹ to remove the `lang` attribute due to the fact
that developers were often forgetting to update its value. This change
turned out not to be the best solution because some of the users:

 * didn't read the documentation, and thus, they found the absence
   of the `lang` attribute confusing, or didn't even knew they had
   to add it

 * didn't notice the absence of the `lang` attribute, and thus, forgot
   to include it (expecting it to be there)

To make things more clearer and to remind users that they need to
specify the primary language of the document, this commit reintroduces
the `lang` attribute, while leaving its value to `""`.

Using `lang=""` has the exact same effect as not specifying the `lang`
attribute at all, in both cases the language being treated as unknown².

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

¹ h5bp/html5-boilerplate#1110
² From WHATWG (http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#attr-lang):

  "To determine the language of a node, user agents must look at the
   nearest ancestor element (including the element itself if the node
   is an element) that has a lang attribute in the XML namespace set
   or is an HTML element and has a lang in no namespace attribute set.
   That attribute specifies the language of the node (regardless of
   its value).

   If both the lang attribute in no namespace and the lang attribute
   in the XML namespace are set on an element, user agents must use
   the lang attribute in the XML namespace, and the lang attribute in
   no namespace must be ignored for the purposes of determining the
   element's language.

   If neither the node nor any of the node's ancestors, including the
   root element, have either attribute set, but there is a pragma-set
   default language set, then that is the language of the node. If there
   is no pragma-set default language set, then language information from
   a higher-level protocol (such as HTTP), if any, must be used as the
   final fallback language instead. In the absence of any such language
   information, and in cases where the higher-level protocol reports
   multiple languages, the language of the node is unknown, and the
   corresponding language tag is the empty string.

   If the resulting value is not a recognized language tag, then it
   must be treated as an unknown language having the given language tag,
   distinct from all other languages."

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Close h5bp/html5-boilerplate#1542.
  • Loading branch information
alrra committed May 13, 2014
1 parent fa293a0 commit 597e9f9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
### HEAD

* Add `lang=""` to `<html>`
([#1542](https://github.com/h5bp/html5-boilerplate/issues/1542)).
* Update to jQuery 1.11.1.
* Update to Modernizr 2.8.0.
* Update to Apache Server Configs 2.3.0.
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="no-js">
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down

0 comments on commit 597e9f9

Please sign in to comment.