Skip to content

Commit

Permalink
[a] (1) Write the restrictions on the contents for CDATA and RCDATA s…
Browse files Browse the repository at this point in the history
…ections. Again. This time hopefully it'll stick.

git-svn-id: http://svn.whatwg.org/webapps@953 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jun 22, 2007
1 parent a6019d6 commit 9546398
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 88 deletions.
100 changes: 61 additions & 39 deletions index
Original file line number Diff line number Diff line change
Expand Up @@ -1443,8 +1443,12 @@
<li><a href="#optional"><span class=secno>8.1.2.4. </span>Optional
tags</a>

<li><a href="#restrictions"><span class=secno>8.1.2.5.
<li><a href="#element-restrictions"><span class=secno>8.1.2.5.
</span>Restrictions on content models</a>

<li><a href="#cdata-rcdata-restrictions"><span class=secno>8.1.2.6.
</span>Restrictions on the contents of CDATA and RCDATA
elements</a>
</ul>

<li><a href="#text"><span class=secno>8.1.3. </span>Text</a>
Expand Down Expand Up @@ -32273,51 +32277,28 @@ function receiver(e) {
<p>Void elements can't have any contents (since there's no end tag, no
content can be put between the start tag and the end tag.)

<p>CDATA elements can have <a href="#text1" title=syntax-text>text</a>.
<p>CDATA elements can have <a href="#text1" title=syntax-text>text</a>,
though it has <a href="#cdata-rcdata-restrictions">restrictions</a>
described below.

<p>RCDATA elements can have <a href="#text1" title=syntax-text>text</a> and
<a href="#character0" title=syntax-entities>character entity
references</a>, but the text must not contain an <a href="#ambiguous"
title=syntax-ambiguous-ampersand>ambiguous ampersand</a>.

<p>The <a href="#text1" title=syntax-text>text</a> in CDATA and RCDATA
elements have two further restrictions:

<ol>
<li>
<p>The last occurrence of the four character sequence "<code
title="">&lt;!--</code>" (U+003C LESS-THAN SIGN, U+0021 EXCLAMATION
MARK, U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS) in the text, if any,
must have a corresponding three-character sequence "<code
title="">--&gt;</code>" (U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS,
U+003E GREATER-THAN SIGN) whose U+003E GREATER-THAN SIGN (&gt;)
character occurs later in the text than the U+003C LESS-THAN SIGN (&lt;)
character of the "<code title="">&lt;!--</code>" sequence.</p>

<p class=note>The hyphens from the "<code title="">&lt;!--</code>" part
can overlap those in the "<code title="">--&gt;</code>" part, as in
"<code title="">&lt!--&gt;</code>".</p>

<li>
<p>There must not be any occurences of the string "<code
title="">&lt;/</code>" (U+003C LESS-THAN SIGN, U+002F SOLIDUS) followed
by characters that case-insensitively<!--ASCII--> match the tag name of
the element followed by one of U+0009 CHARACTER TABULATION, U+000A LINE
FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF), U+0020 SPACE,
U+003E GREATER-THAN SIGN (>), or U+002F SOLIDUS (/).</p>
</ol>
title=syntax-ambiguous-ampersand>ambiguous ampersand</a>. There are also
<a href="#cdata-rcdata-restrictions">further restrictions</a> described
below.

<p>Normal elements can have <a href="#text1" title=syntax-text>text</a>, <a
href="#character0" title=syntax-entities>character entity references</a>,
other <a href="#elements2" title=syntax-elements>elements</a>, and <a
href="#comments0" title=syntax-comments>comments</a>, but the text must
not contain the character U+003C LESS-THAN SIGN (<code>&lt;</code>) or an
<a href="#ambiguous" title=syntax-ambiguous-ampersand>ambiguous
ampersand</a>. Some normal elements also have <a href="#have-extra"
title=syntax-element-restrictions>yet more restrictions</a> on what
content they are allowed to hold, beyond the restrictions imposed by the
content model and those described in this paragraph. Those restrictions
are described below.
ampersand</a>. Some normal elements also have <a
href="#element-restrictions">yet more restrictions</a> on what content
they are allowed to hold, beyond the restrictions imposed by the content
model and those described in this paragraph. Those restrictions are
described below.

<p>Tags contain a <dfn id=tag-name title=syntax-tag-name>tag name</dfn>,
giving the element's name. HTML elements all have names that only use
Expand Down Expand Up @@ -32680,11 +32661,10 @@ function receiver(e) {
<p><strong>However</strong>, a <span title=syntax-start-tag>start
tag</span> must never be omitted if it has any attributes.

<h5 id=restrictions><span class=secno>8.1.2.5. </span>Restrictions on
content models</h5>
<h5 id=element-restrictions><span class=secno>8.1.2.5. </span>Restrictions
on content models</h5>

<p>For historical reasons, certain elements <dfn id=have-extra
title=syntax-element-restrictions>have extra restrictions</dfn> beyond
<p>For historical reasons, certain elements have extra restrictions beyond
even the restrictions given by their content model.

<p>A <code><a href="#p">p</a></code> element must not contain <code><a
Expand Down Expand Up @@ -32730,6 +32710,48 @@ function receiver(e) {
<pre>&lt;pre><br>Hello&lt;/pre></pre>
</div>

<h5 id=cdata-rcdata-restrictions><span class=secno>8.1.2.6.
</span>Restrictions on the contents of CDATA and RCDATA elements</h5>

<p>The text in CDATA and RCDATA elements must not contain any occurences of
the string "<code title="">&lt;/</code>" (U+003C LESS-THAN SIGN, U+002F
SOLIDUS) followed by characters that case-insensitively<!--ASCII--> match
the tag name of the element followed by one of U+0009 CHARACTER
TABULATION, U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM
FEED (FF), U+0020 SPACE, U+003E GREATER-THAN SIGN (>), or U+002F SOLIDUS
(/), unless that string is part of an <a href="#escaped"
title=syntax-escape>escaped text span</a>.

<p>An <dfn id=escaped title=syntax-escape>escaped text span</dfn> is a span
of <a href="#text1" title=syntax-text>text</a> (in CDATA and RCDATA
elements) and <a href="#character0" title=syntax-entities>character entity
references</a> (in RCDATA elements) that starts with an <a
href="#escaping" title=syntax-escape-start>escaping text span start</a>
that is not itself in an <a href="#escaped" title=syntax-escape>escaped
text span</a>, and ends at the next <a href="#escaping0"
title=syntax-escape-end>escaping text span end</a>.

<p>An <dfn id=escaping title=syntax-escape-start>escaping text span start
is a part of <span title=syntax-text>text</span> that consists of the four
character sequence "<code title="">&lt;!--</code>" (U+003C LESS-THAN SIGN,
U+0021 EXCLAMATION MARK, U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS).</dfn>

<p>An <dfn id=escaping0 title=syntax-escape-end>escaping text span end is a
part of <span title=syntax-text>text</span> that consists of the three
character sequence "<code title="">--&gt;</code>" (U+002D HYPHEN-MINUS,
U+002D HYPHEN-MINUS, U+003E GREATER-THAN SIGN) whose U+003E GREATER-THAN
SIGN (&gt;).</dfn>

<p>An <a href="#escaping" title=syntax-escape-start>escaping text span
start</a> may share its U+002D HYPHEN-MINUS characters with its
corresponding <a href="#escaping0" title=syntax-escape-end>escaping text
span end</a>.

<p>The text in CDATA and RCDATA elements must not have an <a
href="#escaping" title=syntax-escape-start>escaping comment start</a> that
is not followed by an <a href="#escaping0"
title=syntax-escape-end>escaping comment end</a>.

<h4 id=text><span class=secno>8.1.3. </span>Text</h4>

<p><dfn id=text1 title=syntax-text>Text</dfn> is allowed inside elements,
Expand Down
105 changes: 56 additions & 49 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -29734,63 +29734,28 @@ function receiver(e) {
tag, no content can be put between the start tag and the end
tag.)</p>

<p>CDATA elements can have <span
title="syntax-text">text</span>.</p>
<p>CDATA elements can have <span title="syntax-text">text</span>,
though it has <a href="#cdata-rcdata-restrictions">restrictions</a>
described below.</p>

<p>RCDATA elements can have <span title="syntax-text">text</span>
and <span title="syntax-entities">character entity
references</span>, but the text must not contain an <span
title="syntax-ambiguous-ampersand">ambiguous ampersand</span>.</p>

<p>The <span title="syntax-text">text</span> in CDATA and RCDATA
elements have two further restrictions:</p>

<ol>

<li>

<p>The last occurrence of the four character sequence "<code
title="">&lt;!--</code>" (U+003C LESS-THAN SIGN, U+0021
EXCLAMATION MARK, U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS) in the
text, if any, must have a corresponding three-character sequence
"<code title="">--&gt;</code>" (U+002D HYPHEN-MINUS, U+002D
HYPHEN-MINUS, U+003E GREATER-THAN SIGN) whose U+003E GREATER-THAN
SIGN (&gt;) character occurs later in the text than the U+003C
LESS-THAN SIGN (&lt;) character of the "<code
title="">&lt;!--</code>" sequence.</p>

<p class="note">The hyphens from the "<code
title="">&lt;!--</code>" part can overlap those in the "<code
title="">--&gt;</code>" part, as in "<code
title="">&lt!--&gt;</code>".</p>

</li>

<li>

<p>There must not be any occurences of the string "<code
title="">&lt;/</code>" (U+003C LESS-THAN SIGN, U+002F SOLIDUS)
followed by characters that case-insensitively<!--ASCII--> match
the tag name of the element followed by one of U+0009 CHARACTER
TABULATION, U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C
FORM FEED (FF), U+0020 SPACE, U+003E GREATER-THAN SIGN (>), or
U+002F SOLIDUS (/).</p>

</li>

</ol>
title="syntax-ambiguous-ampersand">ambiguous ampersand</span>.
There are also <a href="#cdata-rcdata-restrictions">further
restrictions</a> described below.</p>

<p>Normal elements can have <span title="syntax-text">text</span>,
<span title="syntax-entities">character entity references</span>,
other <span title="syntax-elements">elements</span>, and <span
title="syntax-comments">comments</span>, but the text must not
contain the character U+003C LESS-THAN SIGN (<code>&lt;</code>) or
an <span title="syntax-ambiguous-ampersand">ambiguous
ampersand</span>. Some normal elements also have <span
title="syntax-element-restrictions">yet more restrictions</span> on
what content they are allowed to hold, beyond the restrictions
imposed by the content model and those described in this
paragraph. Those restrictions are described below.</p>
ampersand</span>. Some normal elements also have <a
href="#element-restrictions">yet more restrictions</a> on what
content they are allowed to hold, beyond the restrictions imposed by
the content model and those described in this paragraph. Those
restrictions are described below.</p>

<p>Tags contain a <dfn title="syntax-tag-name">tag name</dfn>,
giving the element's name. HTML elements all have names that only
Expand Down Expand Up @@ -30168,10 +30133,9 @@ function receiver(e) {
tag</span> must never be omitted if it has any attributes.</p>


<h5>Restrictions on content models</h5>
<h5 id="element-restrictions">Restrictions on content models</h5>

<p>For historical reasons, certain elements <dfn
title="syntax-element-restrictions">have extra restrictions</dfn>
<p>For historical reasons, certain elements have extra restrictions
beyond even the restrictions given by their content model.</p>

<p>A <code>p</code> element must not contain
Expand Down Expand Up @@ -30213,6 +30177,49 @@ function receiver(e) {
</div>


<h5 id="cdata-rcdata-restrictions">Restrictions on the contents of CDATA and RCDATA elements</h5>

<p>The text in CDATA and RCDATA elements must not contain any
occurences of the string "<code title="">&lt;/</code>" (U+003C
LESS-THAN SIGN, U+002F SOLIDUS) followed by characters that
case-insensitively<!--ASCII--> match the tag name of the element
followed by one of U+0009 CHARACTER TABULATION, U+000A LINE FEED
(LF), U+000B LINE TABULATION, U+000C FORM FEED (FF), U+0020 SPACE,
U+003E GREATER-THAN SIGN (>), or U+002F SOLIDUS (/), unless that
string is part of an <span title="syntax-escape">escaped text
span</span>.</p>

<p>An <dfn title="syntax-escape">escaped text span</dfn> is a span
of <span title="syntax-text">text</span> (in CDATA and RCDATA
elements) and <span title="syntax-entities">character entity
references</span> (in RCDATA elements) that starts with an <span
title="syntax-escape-start">escaping text span start</span> that is
not itself in an <span title="syntax-escape">escaped text
span</span>, and ends at the next <span
title="syntax-escape-end">escaping text span end</span>.</p>

<p>An <dfn title="syntax-escape-start">escaping text span
start</span> is a part of <span title="syntax-text">text</span> that
consists of the four character sequence "<code
title="">&lt;!--</code>" (U+003C LESS-THAN SIGN, U+0021 EXCLAMATION
MARK, U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS).</p>

<p>An <dfn title="syntax-escape-end">escaping text span end</span>
is a part of <span title="syntax-text">text</span> that consists of
the three character sequence "<code title="">--&gt;</code>" (U+002D
HYPHEN-MINUS, U+002D HYPHEN-MINUS, U+003E GREATER-THAN SIGN) whose
U+003E GREATER-THAN SIGN (&gt;).</p>

<p>An <span title="syntax-escape-start">escaping text span
start</span> may share its U+002D HYPHEN-MINUS characters with its
corresponding <span title="syntax-escape-end">escaping text span
end</span>.</p>

<p>The text in CDATA and RCDATA elements must not have an <span
title="syntax-escape-start">escaping comment start</span> that is
not followed by an <span title="syntax-escape-end">escaping comment
end</span>.</p>


<h4>Text</h4>

Expand Down

0 comments on commit 9546398

Please sign in to comment.