- From: CVS User egraff <cvsmail@w3.org>
- Date: Wed, 26 Mar 2014 21:44:10 +0000
- To: public-html-commits@w3.org
Update of /sources/public/html5/html-polyglot
In directory roscoe:/tmp/cvs-serv16835
Modified Files:
html-polyglot.html
Log Message:
Resolved bug 24451, with the edits described in comment 12. These are changes to section 4.6.2.2.1 describing CDATA use.
--- /sources/public/html5/html-polyglot/html-polyglot.html 2014/03/19 23:56:13 1.31
+++ /sources/public/html5/html-polyglot/html-polyglot.html 2014/03/26 21:44:10 1.32
@@ -8,7 +8,7 @@
var respecConfig = {
specStatus: "ED",
shortName: "html-polyglot",
- publishDate: "2014-03-19",
+ publishDate: "2014-03-26",
previousPublishDate: "2010-10-19",
// previousDiffURI: "http://htmlwg.org/heartbeat/WD-html-polyglot-20131008/",
previousMaturity: "WD",
@@ -804,14 +804,50 @@
<ul>
<li> The CDATA section is subject to HTML’s restrictions on <code><script></code> and <code><style></code>.</li>
<li> There can be only one CDATA section per raw text element.</li>
- <!--<li> Before the CDATA section there can only be one node - preferrably only one line of code, which may
- consist of whitespace, or an XML comment, or a construct of the scripting/styling language (usually
- a comment of the scripting/styling language).</li>
- <li> After the CDATA section there can only be one node - preferrably only one line of code, which may
- consist of whitespace, or an XML comment, or a construct of the scripting/styling language (usually
- a comment of the scripting/styling language).</li>-->
+ <li> A CDATA section must appear at the start of its containing element, and hence be the first child of that element.
+ <ul>
+ <li> Before the CDATA section there can only be content that creates one node -
+ preferably only one line of code - which may consist of whitespace, an XML comment,
+ or a construct of the scripting/styling language
+ (usually a comment of the scripting/styling language).</li>
+ <li> After the CDATA section there can only be content that creates one node -
+ preferably only one line of code - which may consist of whitespace, an XML comment,
+ or a construct of the scripting/styling language
+ (usually a comment of the scripting/styling language).</li>
+ </ul>
+ </li>
</ul>
- <p>The <code>]]></code> string:</p>
+ <div class="note">
+ <p>
+ The statement that a "CDATA section must appear at the start of its containing element, and hence be the first child of that element,"
+ is due to how parsers may create DOM nodes based on characters and whitespace.
+ The following script element, because it contains no whitespace outside the CDATA node, has one node,
+ whether parsed as HTML or as XML:
+ <br />
+ <code >
+<script><![CDATA[foo]]>/<script>
+ <br />
+ </code>
+ Because an author may need to comment out the CDATA "start tag" and "end tag,"
+ <a>polyglot markup</a> allows for one node before and after the CDATA section.
+ The following example has three nodes: one text node before the CDATA section,
+ one for the CDATA section, itself, and one after the CDATA section:
+ </p>
+ <figure >
+ <figcaption>CDATA section that is commented out, resulting in a total of three DOM nodes.</figcaption>
+<pre class="example highlight">
+<script>/*<![CDATA[*/
+ foo
+ /*]]>*/</script>
+</pre>
+ </figure>
+ <p>
+ Thus, for <a>polyglot markup</a>, a CDATA section must appear at the start of its containing element,
+ and hence be the first child of that element.
+ </p>
+ </div>
+
+ <p>The <code>]]></code> string:</p>
<ul>
<li> is always commented out if <code><![CDATA[</code> is commented out.</li>
<li> is never commented out if <code><![CDATA[</code> is not commented out.</li>
Received on Wednesday, 26 March 2014 21:44:11 UTC