- From: Eliot Graff via cvs-syncmail <cvsmail@w3.org>
- Date: Fri, 07 May 2010 18:47:05 +0000
- To: public-html-commits@w3.org
Update of /sources/public/html5/html-xhtml-author-guide In directory hutz:/tmp/cvs-serv27928 Modified Files: html-xhtml-authoring-guide.html Log Message: fixed formatting error Index: html-xhtml-authoring-guide.html =================================================================== RCS file: /sources/public/html5/html-xhtml-author-guide/html-xhtml-authoring-guide.html,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- html-xhtml-authoring-guide.html 7 May 2010 18:43:16 -0000 1.7 +++ html-xhtml-authoring-guide.html 7 May 2010 18:47:03 -0000 1.8 @@ -1,97 +1,156 @@ -<!DOCTYPE html> -<html> - <head> +<!DOCTYPE HTML> +<html dir="ltr" lang="en"><head> + + <title>HTML/XHTML Compatibility Authoring Guidelines</title> - <meta http-equiv='Content-Type' content='text/html;charset=utf-8'/> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <!-- === NOTA BENE === For the three scripts below, if your spec resides on dev.w3 you can check them out in the same tree and use relative links so that they'll work offline, --> - <script src='http://dev.w3.org/2009/dap/ReSpec.js/js/respec.js' class='remove'></script> - <script class='remove'> - var respecConfig = { - // specification status (e.g. WD, LCWD, NOTE, etc.). If in doubt use ED. - specStatus: "ED", - - // the specification's short name, as in http://www.w3.org/TR/short-name/ - // TODO: Get URL from Michael Smith - shortName: "xxx-xxx", - - // if you wish the publication date to be other than today, set this - publishDate: "2010-05-06", - - // TODO: Add previous pub date after 2nd publication. - // if there is a previously published draft, uncomment this and set its YYYY-MM-DD date - // and its maturity status - // previousPublishDate: "1977-03-15", - // previousMaturity: "WD", - - // if there a publicly available Editor's Draft, this is the link - // TODO: Uncomment next line and add the link: - edDraftURI: "http://dev.w3.org/html5/html-xhtml-author-guide/html-xhtml-authoring-guide.html", - - // if this is a LCWD, uncomment and set the end of its review period - // lcEnd: "2009-08-05", - - // if you want to have extra CSS, append them to this list - // it is recommended that the respec.css stylesheet be kept - extraCSS: ["http://dev.w3.org/2009/dap/ReSpec.js/css/respec.css"], - - // editors, add as many as you like - // only "name" is required - editors: [ - { name: "Eliot Graff", company: "Microsoft Corporation", }, - - // Format for more editors - // { name: "Your Name", url: "http://example.org/", - // company: "Your Company", companyURL: "http://example.com/" }, - ], - - // authors, add as many as you like. - // This is optional, uncomment if you have authors as well as editors. - // only "name" is required. Same format as editors. - - //authors: [ - // { name: "Your Name", url: "http://example.org/", - // company: "Your Company", companyURL: "http://example.com/" }, - //], - - // name of the WG - wg: "W3C HTML", - - // URI of the public WG page - wgURI: "http://www.w3.org/html/wg/", - - // name (with the @w3c.org) of the public mailing to which comments are due - wgPublicList: "public-html", - - // URI of the patent status for this WG, for Rec-track documents - // !!!! IMPORTANT !!!! - // This is important for Rec-track documents, do not copy a patent URI from a random - // document unless you know what you're doing. If in doubt ask your friendly neighbourhood - // Team Contact. - wgPatentURI: "", - }; - </script> - </head> - <body> - <section id='abstract'> - <p>This document summarizes design guidelines for authors who wish their XHTML or HTML documents to validate on either HTML or XML parsers, assuming the parsers to be HTML5-compliant. - This specification is intended to be used by web authors. It is not a specification for user agents and creates no obligations on user agents. - Note that this recommendation does not define how HTML5-conforming user agents should process HTML documents. - Nor does it define the meaning of the Internet Media Type text/html. For user agent guidance and for these definitions, see [[!HTML5]] and [[!RFC2854]]. + + + <link charset="utf-8" type="text/css" rel="stylesheet" +href="html-xhtml-authoring-guide_files/respec.css"><link charset="utf-8" + type="text/css" rel="stylesheet" +href="html-xhtml-authoring-guide_files/W3C-ED.css"></head><body +style="display: inherit;"><div class="head"><p><a +href="http://www.w3.org/"><img +src="html-xhtml-authoring-guide_files/w3c_home.png" alt="W3C" width="72" + height="48"></a></p><h1 class="title" id="title">HTML/XHTML +Compatibility Authoring Guidelines</h1><h2 +id="w3c-editor-s-draft-06-may-2010"><acronym title="World Wide Web +Consortium">W3C</acronym> Editor's Draft 06 May 2010</h2><dl><dt>This +version:</dt><dd><a +href="http://dev.w3.org/html5/html-xhtml-author-guide/html-xhtml-authoring-guide.html">http://dev.w3.org/html5/html-xhtml-author-guide/html-xhtml-authoring-guide.html</a></dd><dt>Latest + published version:</dt><dd><a href="http://www.w3.org/TR/xxx-xxx/">http://www.w3.org/TR/xxx-xxx/</a></dd><dt>Latest + editor's draft:</dt><dd><a +href="http://dev.w3.org/html5/html-xhtml-author-guide/html-xhtml-authoring-guide.html">http://dev.w3.org/html5/html-xhtml-author-guide/html-xhtml-authoring-guide.html</a></dd><dt>Previous + version:</dt><dd>none</dd><dt>Editor:</dt><dd>Eliot Graff, Microsoft +Corporation</dd></dl><p class="copyright"><a +href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> + © 2010 <a href="http://www.w3.org/"><acronym title="World Wide Web +Consortium"><acronym title="World Wide Web Consortium">W3C</acronym></acronym></a><sup>®</sup> + (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts +Institute of Technology"><acronym title="Massachusetts Institute of +Technology">MIT</acronym></acronym></a>, <a href="http://www.ercim.eu/"><acronym + title="European Research Consortium for Informatics and Mathematics"><acronym + title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></acronym></a>, + <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. <acronym + title="World Wide Web Consortium">W3C</acronym> <a +href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, + <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> + and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document + use</a> rules apply.</p><hr></div> + <div class="introductory section" id="abstract"><h2>Abstract</h2> + <p>This document summarizes design guidelines for authors who wish + their XHTML or HTML documents to validate on either HTML or XML +parsers, assuming the parsers to be HTML5-compliant. + This specification is intended to be used by web authors. It is +not a specification for user agents and creates no obligations on user +agents. + Note that this recommendation does not define how HTML5-conforming + user agents should process HTML documents. + Nor does it define the meaning of the Internet Media Type +text/html. For user agent guidance and for these definitions, see [<a +href="#bib-HTML5" rel="biblioentry" class="bibref">HTML5</a>] and [<a +href="#bib-RFC2854" rel="biblioentry" class="bibref">RFC2854</a>]. </p> - <p><strong>Note:</strong> If your browser does not render the fully-formatted version of this document with images and color fonts, please see <a href="http://dev.w3.org/html5/html-xhtml-author-guide/html-xhtml-authoring-guide-rendered.html">the version without scripts</a>.</p> - </section> + <p><strong>Note:</strong> If your browser does not render the +fully-formatted version of this document with images and color fonts, +please see <a +href="http://dev.w3.org/html5/html-xhtml-author-guide/html-xhtml-authoring-guide-rendered.html">the + version without scripts</a>.</p> + </div><div id="sotd" class="introductory section"><h2>Status of This + Document</h2><p><em>This section describes the status of this document +at the time of its publication. Other documents may supersede this +document. A list of current <acronym title="World Wide Web Consortium">W3C</acronym> + publications and the latest revision of this technical report can be +found in the <a href="http://www.w3.org/TR/"><acronym title="World Wide +Web Consortium">W3C</acronym> technical reports index</a> at +http://www.w3.org/TR/.</em></p><p>This document was published by the <a +href="http://www.w3.org/html/wg/"><acronym title="World Wide Web +Consortium">W3C</acronym> HTML</a> as an Editor's Draft. If you wish to +make comments regarding this document, please send them to <a +href="mailto:public-html@w3.org">public-html@w3.org</a> (<a +href="mailto:public-html-request@w3.org?subject=subscribe">subscribe</a>, + <a href="http://lists.w3.org/Archives/Public/public-html/">archives</a>). + All feedback is welcome.</p><p>Publication as a Editor's Draft does not + imply endorsement by the <acronym title="World Wide Web Consortium">W3C</acronym> + Membership. This is a draft document and may be updated, replaced or +obsoleted by other documents at any time. It is inappropriate to cite +this document as other than work in progress.</p><p>This document was +produced by a group operating under the <a +href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February +2004 <acronym title="World Wide Web Consortium">W3C</acronym> Patent +Policy</a>. <acronym title="World Wide Web Consortium">W3C</acronym> +maintains a <a href="" rel="disclosure">public list of any patent +disclosures</a> made in connection with the deliverables of the group; +that page also includes instructions for disclosing a patent. An +individual who has actual knowledge of a patent which the individual +believes contains <a +href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential + Claim(s)</a> must disclose the information in accordance with <a +href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section + 6 of the <acronym title="World Wide Web Consortium">W3C</acronym> +Patent Policy</a>.</p></div><div class="section" id="toc"><h2 +class="introductory">Table of Contents</h2><ul class="toc"><li +class="tocline"><a class="tocxref" href="#introduction"><span +class="secno">1. </span>Introduction</a></li><li class="tocline"><a +class="tocxref" href="#processing-instructions-and-the-xml-declaration"><span + class="secno">2. </span>Processing Instructions and the XML Declaration</a></li><li + class="tocline"><a class="tocxref" href="#the-doctype"><span +class="secno">3. </span>The DOCTYPE</a></li><li class="tocline"><a +class="tocxref" href="#namespaces"><span class="secno">4. </span>Namespaces</a></li><li + class="tocline"><a class="tocxref" href="#elements"><span class="secno">5. + </span>Elements</a><ul class="toc"><li class="tocline"><a +class="tocxref" href="#required-elements"><span class="secno">5.1 </span>Required + Elements</a><ul class="toc"><li class="tocline"><a class="tocxref" +href="#tables"><span class="secno">5.1.1 </span>Tables</a></li></ul></li><li + class="tocline"><a class="tocxref" href="#case-sensitivity"><span +class="secno">5.2 </span>Case-Sensitivity</a><ul class="toc"><li +class="tocline"><a class="tocxref" href="#element-names"><span +class="secno">5.2.1 </span>Element Names</a></li><li class="tocline"><a +class="tocxref" href="#attribute-names"><span class="secno">5.2.2 </span>Attribute + Names</a></li><li class="tocline"><a class="tocxref" +href="#attribute-characters"><span class="secno">5.2.3 </span>Attribute +Characters</a></li></ul></li><li class="tocline"><a class="tocxref" +href="#empty-elements"><span class="secno">5.3 </span>Empty Elements</a></li></ul></li><li + class="tocline"><a class="tocxref" href="#attributes"><span +class="secno">6. </span>Attributes</a></li><li class="tocline"><a +class="tocxref" href="#named-entity-references"><span class="secno">7. </span>Named + Entity References</a></li><li class="tocline"><a class="tocxref" +href="#script-and-style"><span class="secno">8. </span>Script and Style</a><ul + class="toc"><li class="tocline"><a class="tocxref" +href="#external-script-and-style"><span class="secno">8.1 </span>External + Script and Style</a></li><li class="tocline"><a class="tocxref" +href="#in-line-script-and-style"><span class="secno">8.2 </span>In-line +Script and Style</a></li></ul></li><li class="tocline"><a +class="tocxref" +href="#exceptions-from-the-foreign-content-parsing-rules"><span +class="secno">9. </span>Exceptions from the Foreign Content Parsing +Rules</a></li><li class="tocline"><a class="tocxref" +href="#acknowledgements"><span class="secno">A. </span>Acknowledgements</a></li><li + class="tocline"><a class="tocxref" href="#references"><span +class="secno">B. </span>References</a><ul class="toc"><li +class="tocline"><a class="tocxref" href="#normative-references"><span +class="secno">B.1 </span>Normative references</a></li><li +class="tocline"><a class="tocxref" href="#informative-references"><span +class="secno">B.2 </span>Informative references</a></li></ul></li></ul></div> - <section> - <h2>Introduction</h2> + <div class="section" id="introduction"> + <!--OddPage--><h2><span class="secno">1. </span>Introduction</h2> <p> - It is often valuable to be able to serve HTML5 documents that are also valid XML documents. - An author may, for example, use XML tools to generate a document, and they and others may process the document using XML tools. These documents are served as text/html. - The language used to create documents that can be parsed by both HTML and XML parsers is called <dfn>polyglot</dfn>. - Polyglot is the overlap language of documents which are both HTML5 documents and XML documents. + It is often valuable to be able to serve HTML5 documents that +are also valid XML documents. + An author may, for example, use XML tools to generate a +document, and they and others may process the document using XML tools. +These documents are served as text/html. + The language used to create documents that can be parsed by both HTML +and XML parsers is called <dfn id="dfn-polyglot">polyglot</dfn>. + Polyglot is the overlap language of documents which are both HTML5 +documents and XML documents. <!-- <ul> TODO: in this section: @@ -100,69 +159,99 @@ </ul> --> </p> - </section> + </div> - <section> - <h2>Processing Instructions and the XML Declaration</h2> + <div class="section" +id="processing-instructions-and-the-xml-declaration"> + <!--OddPage--><h2><span class="secno">2. </span>Processing Instructions + and the XML Declaration</h2> <p> - You MUST NOT use processing instructions in a polyglot document. - Note that the parsing rules for the XML declaration are not processing instructions and are defined separately in <a href="http://www.w3.org/TR/REC-xml/#NT-XMLDecl">Prolog and Document Type Declaration</a>. + You <em title="must not" class="rfc2119">must not</em> use processing + instructions in a polyglot document. + Note that the parsing rules for the XML declaration are not +processing instructions and are defined separately in <a +href="http://www.w3.org/TR/REC-xml/#NT-XMLDecl">Prolog and Document Type + Declaration</a>. <!-- TODO: Add Normative link once generated --> </p> <p> - You SHOULD use the HTML <code>meta</code> tag to specify character and coding in the document. - You MAY use either UTF-8 or UTF-16, although generally UTF-8 is preferred. If you use UTF-16, you SHOULD include the BOM indicating UTF-16LE or UTF-16BE. In addition, you need not include the meta charset declaration, because the parser would have to read UTF-16 in order to parse it by definition. + You <em title="should" class="rfc2119">should</em> use the HTML <code>meta</code> + tag to specify character and coding in the document. + You <em title="may" class="rfc2119">may</em> use either UTF-8 or +UTF-16, although generally UTF-8 is preferred. If you use UTF-16, you <em + title="should" class="rfc2119">should</em> include the BOM indicating +UTF-16LE or UTF-16BE. In addition, you need not include the meta charset + declaration, because the parser would have to read UTF-16 in order to +parse it by definition. </p> <p> - In short, for correct character encoding for a polyglot document, you MUST either: - <ul> + In short, for correct character encoding for a polyglot document, you + <em title="must" class="rfc2119">must</em> either: + </p><ul> <li>Use UTF-8 or UTF-16 with the appropriate BOM.</li> </ul> <strong>OR</strong> <ul> - <li>Use both the XML Declaration and <code>meta</code> tag to specify the appropriate character encoding.</li> + <li>Use both the XML Declaration and <code>meta</code> tag to +specify the appropriate character encoding.</li> </ul> - </p> + <p> - If a polyglot document uses an encoding other than UTF-8 or UTF-16, you SHOULD include the XML declaration; however, in this case you SHOULD also include the HTML <code>meta</code> tag specifying the character set. - When you use both the XML declaration and the HTML <code>meta</code> tag, they MUST specify the same character and coding. + If a polyglot document uses an encoding other than UTF-8 or UTF-16, +you <em title="should" class="rfc2119">should</em> include the XML +declaration; however, in this case you <em title="should" +class="rfc2119">should</em> also include the HTML <code>meta</code> tag +specifying the character set. + When you use both the XML declaration and the HTML <code>meta</code> +tag, they <em title="must" class="rfc2119">must</em> specify the same +character and coding. </p> - </section> + </div> - <section> - <h2>The DOCTYPE</h2> + <div class="section" id="the-doctype"> + <!--OddPage--><h2><span class="secno">3. </span>The DOCTYPE</h2> <p> - For a polyglot document, you MUST use the <code><!DOCTYPE html></code> doctype. - Note that for a polyglot document the string, <code>html</code>, MUST be lower case. - For a pure HTML document, the string is defined as case-insensitive. [[!HTML5]] + For a polyglot document, you <em title="must" class="rfc2119">must</em> + use the <code><!DOCTYPE html></code> doctype. + Note that for a polyglot document the string, <code>html</code>, <em +title="must" class="rfc2119">must</em> be lower case. + For a pure HTML document, the string is defined as case-insensitive. [<a + href="#bib-HTML5" rel="biblioentry" class="bibref">HTML5</a>] </p> - </section> + </div> - <section> - <h2>Namespaces</h2> + <div class="section" id="namespaces"> + <!--OddPage--><h2><span class="secno">4. </span>Namespaces</h2> <p> - The following rules apply to namespaces used in polyglot documents. + The following rules apply to namespaces used in polyglot +documents. </p> <ul> <li> - The <code><html></code> element MUST have the namespace declaration <code>xmlns="http://www.w3.org/1999/xhtml"</code>. + The <code><html></code> element <em title="must" +class="rfc2119">must</em> have the namespace declaration <code>xmlns="http://www.w3.org/1999/xhtml"</code>. </li> <li> - All <code><math></code> elements MUST have the namespace declaration <code>xmlns="http://www.w3.org/1998/Math/MathML"</code>. + All <code><math></code> elements <em title="must" +class="rfc2119">must</em> have the namespace declaration <code>xmlns="http://www.w3.org/1998/Math/MathML"</code>. </li> <li> - All <code><svg></code> elements MUST have the namespace declaration <code>xmlns="http://www.w3.org/2000/svg"</code>. + All <code><svg></code> elements <em title="must" +class="rfc2119">must</em> have the namespace declaration <code>xmlns="http://www.w3.org/2000/svg"</code>. </li> <li> - The xlink prefix MUST be defined as <code>xmlns:xlink="http://www.w3.org/1999/xlink"</code> before using xlink:href. The prefix can be defined either: + The xlink prefix <em title="must" class="rfc2119">must</em> be +defined as <code>xmlns:xlink="http://www.w3.org/1999/xlink"</code> +before using xlink:href. The prefix can be defined either: <ul> <li> Once on the root <code><html></code> element. </li> <li> - Once on each <code><svg></code> element that contains one or more elements with xlink:href attributes. + Once on each <code><svg></code> element that contains +one or more elements with xlink:href attributes. </li> </ul> </li> @@ -170,58 +259,66 @@ No other elements should have namespace declarations. </li> </ul> - </section> + </div> - <section> - <h2>Elements</h2> - <section> - <h3>Required Elements</h3> + <div class="section" id="elements"> + <!--OddPage--><h2><span class="secno">5. </span>Elements</h2> + <div class="section" id="required-elements"> + <h3><span class="secno">5.1 </span>Required Elements</h3> <p> - Each document MUST have a root <code>html</code> element. The root <code>html</code> element MUST contain both a <code>head</code> and a <code>body</code> element. - The <code>head</code> element MUST contain a <code>title</code> element. + Each document <em title="must" class="rfc2119">must</em> have a +root <code>html</code> element. The root <code>html</code> element <em +title="must" class="rfc2119">must</em> contain both a <code>head</code> +and a <code>body</code> element. + The <code>head</code> element <em title="must" class="rfc2119">must</em> + contain a <code>title</code> element. </p> - <section> - <h3>Tables</h3> + <div class="section" id="tables"> + <h4><span class="secno">5.1.1 </span>Tables</h4> <p> - For a polyglot document, a table MUST explicitly have a <code>tbody</code> element surrounding groups of <code>tr</code> elements. - HTML pasrsers insert the <code>tbody</code> element, but XML parsers do not, thus creating different DOMs. + For a polyglot document, a table <em title="must" class="rfc2119">must</em> + explicitly have a <code>tbody</code> element surrounding groups of <code>tr</code> + elements. + HTML pasrsers insert the <code>tbody</code> element, but XML +parsers do not, thus creating different DOMs. </p> <p> Correct: - <pre class="example"> -<table> + </p><pre class="example"><table> <tbody> - <tr>... - </pre> + <tr>...</pre> Incorrect: - <pre class="example"> -<table> - <tr>... - </pre> - </p> - </section> - </section> + <pre class="example"><table> + <tr>...</pre> + + </div> + </div> - <section> - <h2>Case-Sensitivity</h2> + <div class="section" id="case-sensitivity"> + <h3><span class="secno">5.2 </span>Case-Sensitivity</h3> <p> The following guidelines apply to markup, script, and CSS. </p> - <section> - <h3>Element Names</h3> - <p>You MUST use the correct case for element names.</p> + <div class="section" id="element-names"> + <h4><span class="secno">5.2.1 </span>Element Names</h4> + <p>You <em title="must" class="rfc2119">must</em> use the +correct case for element names.</p> <ul> <li> - Element names MUST be lowercase for all HTML elements. + Element names <em title="must" class="rfc2119">must</em> be +lowercase for all HTML elements. </li> <li> - Element names MUST be lowercase for all MathML elements. + Element names <em title="must" class="rfc2119">must</em> be +lowercase for all MathML elements. </li> <li> - Element names MUST be lowercase for all SVG elements except the following, which MUST be in mixed case: + Element names <em title="must" class="rfc2119">must</em> be +lowercase for all SVG elements except the following, which <em +title="must" class="rfc2119">must</em> be in mixed case: <ul> <li><code>altGlyph</code></li> <li><code>altGlyphDef</code></li> @@ -262,24 +359,33 @@ </ul> </li> </ul> - </section> + </div> - <section> - <h3>Attribute Names</h3> + <div class="section" id="attribute-names"> + <h4><span class="secno">5.2.2 </span>Attribute Names</h4> <p> - You MUST use the correct case for attribute names. - When required, you MUST use lower case letters for all ASCII letters; however, case requirements do not apply to non-ASCII letters such as Greek, Cyrillic, or non-ASCII Latin letters. + You <em title="must" class="rfc2119">must</em> use the correct case + for attribute names. + When required, you <em title="must" class="rfc2119">must</em> use +lower case letters for all ASCII letters; however, case requirements do +not apply to non-ASCII letters such as Greek, Cyrillic, or non-ASCII +Latin letters. </p> <ul> <li> - Attribute names MUST be lowercase for all HTML elements. + Attribute names <em title="must" class="rfc2119">must</em> + be lowercase for all HTML elements. </li> <li> - Attribute names MUST be lowercase for all MathML elements except the following: - <p>The lowercase <code>definitionurl</code> MUST be changed to the mixed case <code>definitionURL</code>.</p> + Attribute names <em title="must" class="rfc2119">must</em> + be lowercase for all MathML elements except the following: + <p>The lowercase <code>definitionurl</code> <em +title="must" class="rfc2119">must</em> be changed to the mixed case <code>definitionURL</code>.</p> </li> <li> - Attribute names MUST be lowercase for all SVG elements except the following, which MUST be in mixed case: + Attribute names <em title="must" class="rfc2119">must</em> + be lowercase for all SVG elements except the following, which <em +title="must" class="rfc2119">must</em> be in mixed case: <ul> <li><code>attributeName</code></li> <li><code>attributeType</code></li> @@ -346,22 +452,27 @@ </ul> </li> </ul> - </section> + </div> - <section> - <h3>Attribute Characters</h3> + <div class="section" id="attribute-characters"> + <h4><span class="secno">5.2.3 </span>Attribute Characters</h4> <p> - You MUST specify attribute letters as lowercase. - When required, you MUST use lower case letters for all ASCII letters; however, case requirements do not apply to non-ASCII letters such as Greek, Cyrillic, or non-ASCII Latin letters. + You <em title="must" class="rfc2119">must</em> specify attribute +letters as lowercase. + When required, you <em title="must" class="rfc2119">must</em> use +lower case letters for all ASCII letters; however, case requirements do +not apply to non-ASCII letters such as Greek, Cyrillic, or non-ASCII +Latin letters. </p> - </section> - </section> + </div> + </div> - <section> - <h2>Empty Elements</h2> + <div class="section" id="empty-elements"> + <h3><span class="secno">5.3 </span>Empty Elements</h3> <p> - You MAY use only the elements in the following table as empty elements. + You <em title="may" class="rfc2119">may</em> use only the +elements in the following table as empty elements. </p> <ul> <li><code>area</code></li> @@ -380,29 +491,38 @@ <li><code>source</code></li> </ul> <p> - You MUST use the minimized tag syntax for empty elements, e.g. <code><br/></code>. - The alternative syntax <code><br></br></code> allowed by XML gives uncertain results in many existing user agents. + You <em title="must" class="rfc2119">must</em> use the minimized + tag syntax for empty elements, e.g. <code><br/></code>. + The alternative syntax <code><br></br></code> +allowed by XML gives uncertain results in many existing user agents. </p> <p> - Given an empty instance of an element whose content model is not EMPTY (for example, an empty title or paragraph) do not use the minimized form (e.g. use <code><p> </p></code> and not <code><p /></code>). + Given an empty instance of an element whose content model is not + EMPTY (for example, an empty title or paragraph) do not use the +minimized form (e.g. use <code><p> </p></code> and not <code><p + /></code>). </p> <p> - Note that MathML and SVG elements may be either self-closing or contain content. + Note that MathML and SVG elements may be either self-closing or + contain content. </p> - </section> - </section> + </div> + </div> - <section> - <h2>Attributes</h2> - <p>Avoid line breaks and multiple white space characters within attribute characters. These are handled inconsistently by user agents.</p> + <div class="section" id="attributes"> + <!--OddPage--><h2><span class="secno">6. </span>Attributes</h2> + <p>Avoid line breaks and multiple white space characters within +attribute characters. These are handled inconsistently by user agents.</p> <p>See also <a href="#attribute-values">Attribute Characters</a>.</p> - </section> + </div> - <section> - <h2>Named Entity References</h2> + <div class="section" id="named-entity-references"> + <!--OddPage--><h2><span class="secno">7. </span>Named Entity +References</h2> <p> - You MUST use only the following named entity references: + You <em title="must" class="rfc2119">must</em> use only the +following named entity references: </p> <ul> <li><code>amp</code></li> @@ -412,90 +532,128 @@ <li><code>quot</code></li> </ul> <p> - When you need entities beyond the previous list, use character references. + When you need entities beyond the previous list, use character +references. </p> - </section> + </div> - <section> - <h2>Script and Style</h2> + <div class="section" id="script-and-style"> + <!--OddPage--><h2><span class="secno">8. </span>Script and Style</h2> <p> - Script and style commands SHOULD be included by linking to external files rather than including them in-line. + Script and style commands <em title="should" class="rfc2119">should</em> + be included by linking to external files rather than including them +in-line. </p> <p> - Although you MAY use <code>document.write()</code> and <code>document.writeln()</code> in an HTML document, you MUST NOT use either function in XHTML and therefore in a polyglot document. - Instead, use the <code>innerHTML</code> property for both HTML and XHTML. + Although you <em title="may" class="rfc2119">may</em> use <code>document.write()</code> + and <code>document.writeln()</code> in an HTML document, you <em +title="must not" class="rfc2119">must not</em> use either function in +XHTML and therefore in a polyglot document. + Instead, use the <code>innerHTML</code> property for both HTML +and XHTML. Note that the <code>innerHTML</code> property takes a string. XML parsers parse the string as XML in XHTML. HTML parsers parse the string as HTML in HTML. - Therefore, if you send the parser content that does not follow the rules for a polyglot document the results will differ for a DOM create with an XML parser and one created with an HTML parser. + Therefore, if you send the parser content that does not follow +the rules for a polyglot document the results will differ for a DOM +create with an XML parser and one created with an HTML parser. </p> - <section> - <h3>External Script and Style</h3> + <div class="section" id="external-script-and-style"> + <h3><span class="secno">8.1 </span>External Script and Style</h3> <p> - You MUST use external scripts if your script uses <code><</code> or <code>&</code> or <code>]]></code> or <code>--</code>. - You MUST use external style sheets if your style sheet uses <code><</code> or <code>&</code> or <code>]]></code> or <code>--</code>. - Note that XML parsers are permitted to silently remove the contents of comments; therefore, the historical practice of hiding scripts and style sheets within comments to make the documents backward compatible is likely to not work as expected in XML-based user agents. + You <em title="must" class="rfc2119">must</em> use external +scripts if your script uses <code><</code> or <code>&</code> or <code>]]></code> + or <code>--</code>. + You <em title="must" class="rfc2119">must</em> use external +style sheets if your style sheet uses <code><</code> or <code>&</code> + or <code>]]></code> or <code>--</code>. + Note that XML parsers are permitted to silently remove the +contents of comments; therefore, the historical practice of hiding +scripts and style sheets within comments to make the documents backward +compatible is likely to not work as expected in XML-based user agents. </p> - </section> - <section> - <h3>In-line Script and Style</h3> + </div> + <div class="section" id="in-line-script-and-style"> + <h3><span class="secno">8.2 </span>In-line Script and Style</h3> <p> - If you must use script or style commands within your source code, either use safe content or wrap the command in a CDATA section. However, you SHOULD NOT use a <code>CDATA</code> section unless it is being used within foreign content. - <ul> - <li>Safe content is content that does not contain a <code><</code> or <code>&</code> character. - The following example is safe because it does not contain problematic characters within the <code><script></code> tag. - <pre class='example'> - <script>document.body.appendChild(document.createElement("div"));</script> - </pre> + If you must use script or style commands within your source code, + either use safe content or wrap the command in a CDATA section. +However, you <em title="should not" class="rfc2119">should not</em> use a + <code>CDATA</code> section unless it is being used within foreign +content. + </p><ul> + <li>Safe content is content that does not contain a <code><</code> + or <code>&</code> character. + The following example is safe because it does not contain +problematic characters within the <code><script></code> tag. + <pre class="example"><script>document.body.appendChild(document.createElement("div"));</script></pre> </li> <li>Wrap in-line script and style commands in a CDATA section</li> <p> - Note that you cannot achieve same DOM in both XHTML and HTML by using in-line commands in a CDATA section. - However, this is not usally a problem unless the code has a dependency on the exact number of text nodes under a <code><script></code> or <code><style></code> element. - The following examples show in-line script and style commands wrapped in a <code>CDATA</code> section. + Note that you cannot achieve same DOM in both XHTML and HTML by +using in-line commands in a CDATA section. + However, this is not usally a problem unless the code has a +dependency on the exact number of text nodes under a <code><script></code> + or <code><style></code> element. + The following examples show in-line script and style commands +wrapped in a <code>CDATA</code> section. </p> - <pre class="example"> -<script> + <pre class="example"><script> //<![CDATA[ (script goes here) //]]> -</script> - - </pre> - <pre class="example"> -<style> +</script></pre> + <pre class="example"><style> /*<![CDATA[*/ (styles go here) -/*]]>*/ -</style> - - </pre> +/*]]>*/ +</style></pre> <p> - When using MathML or SVG, the parser follows the XML parsing rules. - You MUST NOT rely on getting a CDATA instance from the DOM when using MathML or SVG, because the HTML parser does not create a CDATA instance in the DOM. + When using MathML or SVG, the parser follows the XML parsing +rules. + You <em title="must not" class="rfc2119">must not</em> rely on +getting a CDATA instance from the DOM when using MathML or SVG, because +the HTML parser does not create a CDATA instance in the DOM. </p> </ul> - </p> - </section> - </section> + + </div> + </div> - <section> - <h2>Exceptions from the Foreign Content Parsing Rules</h2> + <div class="section" +id="exceptions-from-the-foreign-content-parsing-rules"> + <!--OddPage--><h2><span class="secno">9. </span>Exceptions from +the Foreign Content Parsing Rules</h2> <p> <!-- TODO: Need to call out exceptions from the foreign content parsing rules (e.g. <foreignContent> --> </p> - </section> + </div> - <section class='appendix'> - <h2>Acknowledgements</h2> + <div id="acknowledgements" class="appendix section"> + <!--OddPage--><h2><span class="secno">A. </span>Acknowledgements</h2> <p> Many thanks to Tony Ross, Jonas Sicking, and Sam Ruby. </p> - </section> - </body> -</html> + </div> + <div class="appendix section" id="references"><!--OddPage--><h2><span +class="secno">B. </span>References</h2><div class="section" +id="normative-references"><h3><span class="secno">B.1 </span>Normative +references</h3><dl class="bibliography"><dt id="bib-HTML5">[HTML5]</dt><dd>Ian + Hickson; David Hyatt. <a +href="http://www.w3.org/TR/2010/WD-html5-20100304/"><cite>HTML 5.</cite></a> + 4 March 2010. W3C Working Draft. (Work in progress.) URL: <a +href="http://www.w3.org/TR/2010/WD-html5-20100304/">http://www.w3.org/TR/2010/WD-html5-20100304/</a> + +</dd><dt id="bib-RFC2854">[RFC2854]</dt><dd>D. Connolly; L. Masinter. <a + href="http://www.rfc-editor.org/rfc/rfc2854.txt"><cite>The 'text/html' +Media Type.</cite></a> June 2000. Internet RFC 2854. URL: <a +href="http://www.rfc-editor.org/rfc/rfc2854.txt">http://www.rfc-editor.org/rfc/rfc2854.txt</a> + +</dd></dl></div><div class="section" id="informative-references"><h3><span + class="secno">B.2 </span>Informative references</h3><p>No informative +references.</p></div></div></body></html> \ No newline at end of file
Received on Friday, 7 May 2010 18:47:09 UTC