Bugzilla – Bug 413
Require <meta charset> within the first 512 bytes. (credit: hs)
Last modified: 2016-02-04 17:47:34 CET
Index: source =================================================================== --- source (revision 2555) +++ source (revision 2556) @@ -8986,7 +8986,7 @@ <dt>Categories</dt> <dd><span>Metadata content</span>.</dd> <dt>Contexts in which this element may be used:</dt> - <dd>If the <code title="attr-meta-charset">charset</code> attribute is present, or if the element is in the <span title="attr-meta-http-equiv-content-type">Encoding declaration state</span>: as the first element in a <code>head</code> element.</dd> + <dd>If the <code title="attr-meta-charset">charset</code> attribute is present, or if the element is in the <span title="attr-meta-http-equiv-content-type">Encoding declaration state</span>: in a <code>head</code> element.</dd> <dd>If the <code title="attr-meta-http-equiv">http-equiv</code> attribute is present, and the element is not in the <span title="attr-meta-http-equiv-content-type">Encoding declaration state</span>: in a <code>head</code> element.</dd> <dd>If the <code title="attr-meta-http-equiv">http-equiv</code> attribute is present, and the element is not in the <span title="attr-meta-http-equiv-content-type">Encoding declaration state</span>: in a <code>noscript</code> element that is a child of a <code>head</code> element.</dd> <dd>If the <code title="attr-meta-name">name</code> attribute is present: where <span>metadata content</span> is expected.</dd> @@ -9038,10 +9038,9 @@ <p>The <code title="attr-meta-charset">charset</code> attribute may be specified in <span title="HTML5">HTML documents</span> only, it - must not be used in <span title="XHTML">XML documents</span>. If the - <code title="attr-meta-charset">charset</code> attribute is - specified, the element must be the first element in <span>the - <code>head</code> element</span> of the file.</p> + must not be used in <span title="XHTML">XML documents</span>. There + must not be more than one element with a <code + title="attr-meta-charset">charset</code> attribute per document.</p> <p>The <dfn title="attr-meta-content"><code>content</code></dfn> attribute gives the value of the document metadata or pragma @@ -9387,11 +9386,9 @@ <p>If the document contains a <code>meta</code> element in the <span title="attr-meta-http-equiv-content-type">Encoding - declaration state</span> then that element must be the first - element in the document's <code>head</code> element, and the - document must not contain a <code>meta</code> element with the - <code title="attr-meta-charset">charset</code> attribute - present.</p> + declaration state</span>, then the document must not contain a + <code>meta</code> element with the <code + title="attr-meta-charset">charset</code> attribute present.</p> <p>The <span title="attr-meta-http-equiv-content-type">Encoding declaration state</span> may be used in <span title="HTML5">HTML @@ -9649,6 +9646,10 @@ the use of <span title="syntax-charref">character references</span> or character escapes of any kind.</li> + <li id="charset512">The element containing the character encoding + declaration must be serialised completely within the first 512 + bytes of the document.</p> + </ul> <p>If the document does not start with a BOM, and if its encoding is
This has since been increased to 1024 bytes. > The element containing the character encoding declaration must be serialized > completely within the first 1024 bytes of the document. Source: http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#charset