- From: Simon Pieters via cvs-syncmail <cvsmail@w3.org>
- Date: Fri, 14 Sep 2012 14:19:05 +0000
- To: public-html-commits@w3.org
Update of /sources/public/html5/html4-differences In directory hutz:/tmp/cvs-serv15279 Modified Files: Overview.src.html Log Message: elaborate on syntax Index: Overview.src.html =================================================================== RCS file: /sources/public/html5/html4-differences/Overview.src.html,v retrieving revision 1.204 retrieving revision 1.205 diff -u -d -r1.204 -r1.205 --- Overview.src.html 14 Sep 2012 12:53:01 -0000 1.204 +++ Overview.src.html 14 Sep 2012 14:19:03 -0000 1.205 @@ -222,7 +222,7 @@ type.</p> <p>HTML5 also defines detailed parsing rules (including "error - handling") for this syntax which are largely compatible with popular + handling") for this syntax which are largely compatible with HTML4-era implementations. User agents must use these rules for resources that have the <code>text/html</code> media type. Here is an example document that conforms to the HTML syntax:</p> @@ -299,6 +299,13 @@ written using the HTML syntax. Browsers already do this for <code><!DOCTYPE html></code>.</p> + <p>To support legacy markup generators that cannot generate the preferred + short doctype, the doctype <code><!DOCTYPE html SYSTEM + "about:legacy-compat"></code> is allowed in the HTML syntax. + + <p>The strict doctypes for HTML 4.0, HTML 4.01, XHTML 1.0 as well as XHTML + 1.1 are also allowed (but are discouraged) in the HTML syntax. + <p>In the XML syntax, any doctype declaration may be used, or it may be omitted altogether. Documents with an XML media type are always handled in standards mode. @@ -307,7 +314,19 @@ <h3 id="mathml-svg">MathML and SVG</h3> <p>The HTML syntax of HTML5 allows for MathML and SVG elements to - be used inside a document. For instance, a very simple document using some of the + be used inside a document. An <code>math</code> or <code>svg</code> start + tag causes the HTML parser to switch to a special insertion mode which puts + elements and attributes in the appropriate namespaces, does case fixups for + elements and attributes that have mixed case, and supports the empty-element + syntax as in XML. The syntax is still case-insensitive and attributes allow + the same syntax as for HTML elements. Namespace declarations may be omitted. + CDATA sections are supported in this insertion mode. + + <p>Some MathML and SVG elements cause the parser to switch back to "HTML + mode", e.g. <code>mtext</code> and <code>foreignObject</code>, so you can + use HTML elements or a new <code>math</code> or <code>svg</code> element. + + <p>For instance, a very simple document using some of the minimal syntax features could look like:</p> <pre><code><!doctype html> @@ -317,19 +336,39 @@ <strong><svg> <circle r="50" cx="50" cy="50" fill="green"/> </svg></strong> </p></code></pre> - <p>More complex combinations are also possible. For instance, with the SVG - <code>foreignObject</code> element you could nest MathML, HTML, or both - inside an SVG fragment that is itself inside HTML.</p> - - <h3 id="syntax-misc">Miscellaneous</h3> - <p>There are a few other syntax changes worthy of mentioning:</p> + <p>There are a few other changes in the HTML syntax worthy of mentioning:</p> <ul> <li>The <code>&lang;</code> and <code>&rang;</code> named character references now expand to U+27E8 and U+27E9 instead of U+2329 and U+232A, respectively. + + <li>Many new named character references have been added, including all from + MathML. + + <li>Void elements (known as "EMPTY" in HTML4) are allowed to have a + trailing slash. + + <li>The ampersand (<code>&</code>) may be left unescaped in some more + cases compared to HTML4. + + <li>Attributes have to be separated by at least one whitespace character. + + <li>Attributes with an empty value may be written as just the attribute + name omitting the equals sign and the value, even if it's not a boolean + attribute. (HTML4 actually allowed using only the attribute + <em>value</em> and omitting the attribute name, for enumerated attributes, + but this was not supported in browsers.) + + <li>Attributes omitting quotes for the value are allowed to use a larger + set of characters compared to HTML4. + + <li>The <code>optgroup</code> end tag is now optional. + + <li>The <code>colgroup</code> start tag is now optional and is inferred by + the HTML parser. </ul>
Received on Friday, 14 September 2012 14:19:06 UTC