- From: CVS User egraff <cvsmail@w3.org>
- Date: Wed, 24 Apr 2013 00:56:20 +0000
- To: public-html-commits@w3.org
Update of /sources/public/html5/html-xhtml-author-guide In directory roscoe:/tmp/cvs-serv10751 Modified Files: html-xhtml-authoring-guide.html Log Message: Edited Section 9, Script and Style, as requested in bug 14041. --- /sources/public/html5/html-xhtml-author-guide/html-xhtml-authoring-guide.html 2013/04/18 23:27:00 1.97 +++ /sources/public/html5/html-xhtml-author-guide/html-xhtml-authoring-guide.html 2013/04/24 00:56:20 1.98 @@ -10,7 +10,7 @@ var respecConfig = { specStatus: "ED", shortName: "html-polyglot", - publishDate: "2013-04-18", + publishDate: "2013-04-23", previousPublishDate: "2010-10-19", previousMaturity: "WD", edDraftURI: "http://dev.w3.org/html5/html-xhtml-author-guide/html-xhtml-authoring-guide.html", @@ -122,7 +122,7 @@ <section id="character-encoding" class="section"> <h2>Specifying a Document's Character Encoding</h2> <p> - Polyglot markup uses the UTF-8 character encoding, the only character encoding for which both HTML and XML require support. + <a title="polyglot markup">Polyglot markup</a> uses the UTF-8 character encoding, the only character encoding for which both HTML and XML require support. HTML requires UTF-8 to be explicitly declared to avoid <a href="http://www.w3.org/TR/html5/semantics.html#charset">fallback to a legacy encoding</a> [[!HTML5]]. For XML, UTF-8 is an <a href="http://www.w3.org/TR/2008/REC-xml-20081126/#charencoding">encoding default</a>. As such, character encoding MAY be left undeclared in XML with the result that UTF-8 is still supported [[!XML10]]. @@ -738,31 +738,54 @@ Because of the difference in parsing, if you send the parser content that does not follow the rules for <a>polyglot markup</a> the results will differ for a DOM create with an XML parser and one created with an HTML parser. </p> - - <section id="external-script-and-style" class="section"> - <h3>External Script and Style</h3> - <p><a title="polyglot markup">Polyglot markup</a> uses external scripts if that document's script or 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> - - <!--End section: External Script and Style--> - </section> - - <section id="in-line-script-and-style" class="section"> - <h3>In-line Script and Style</h3> - <p> - When <a>polyglot markup</a> must use script or style commands within its source code, it uses safe content. - </p> - <p> - 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. - </p> +<section id="ambiguous-strings"> +<h3>Ambiguous Strings</h3> + <p> + Except for noted exceptions (such as <code>xml:lang="foo"</code>), + <a>polyglot markup</a> does not use <a>ambiguous strings</a>. + In <a>polyglot markup</a>, <dfn>ambiguous strings</dfn> are those strings that XML interprets differently from HTML and vice-versa. + Therefore, for the content of <code>script</code> and <code>style</code> tags, <a>polyglot markup</a> does not use the following strings: + </p> + <table class="simple"> + <thead> + <tr> + <th>String</th> + <th>Notes</th> + </tr> + </thead> + <tbody> + <tr> + <td><</td> + <td> + XML interprets the less than symbol as the commencement of a tag, comment, or CDATA block, + even if the symbol occurs within <code>script</code> or <code>style</code> tags. + </td> + </tr> + + <tr> + <td>&</td> + <td> + XML interprets the ampersand as the commencement of a reference or entity, + even if the symbol occurs within <code>script</code> or <code>style</code> tags. + As a consequence, <a>polyglot markup</a> does not contain <code>script</code> or <code>style</code> elements + that contain HTML entities, XML entities, or character references. + </td> + </tr> + + <tr> + <td>]]></td> + <td>XML interprets this string as the end of a CDATA block.</td> + </tr> + </tbody> + </table> + <p>The following example is <a>polyglot markup</a> because there are no <a>ambiguous strings</a> within the <code>script</code> tag. </p> <pre class="example highlight"><script>document.body.appendChild(document.createElement("div"));</script></pre> - - <!--End section: In-line Script and Style--> + <p class="note"> + A workaround for using ambiguous strings is to include the properly escaped characters + inside the <code>@src</code> attribute of <code>style</code> or <code>script</code> tags. + </p> + <!-- End section: Ambiguous strings --> </section> - <!--End section: Script and Style--> </section>
Received on Wednesday, 24 April 2013 00:56:23 UTC