Skip to content

Commit

Permalink
[ac] (2) Restrict the contents of <style> for compat with IE/Opera/We…
Browse files Browse the repository at this point in the history
…bKit. Loosen the restrictions on <script> where they would be impossible to violate in text/html.

git-svn-id: http://svn.whatwg.org/webapps@4340 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Oct 27, 2009
1 parent 3df6d41 commit 4fa68d0
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 12 deletions.
25 changes: 21 additions & 4 deletions complete.html
Expand Up @@ -11930,7 +11930,7 @@ <h4 id=the-style-element><span class=secno>4.2.6 </span>The <dfn><code>style</co
<dd>If the <code title=attr-style-scoped><a href=#attr-style-scoped>scoped</a></code> attribute is absent: in a <code><a href=#the-noscript-element>noscript</a></code> element that is a child of a <code><a href=#the-head-element-0>head</a></code> element.</dd>
<dd>If the <code title=attr-style-scoped><a href=#attr-style-scoped>scoped</a></code> attribute is present: where <a href=#flow-content>flow content</a> is expected, but before any other <a href=#flow-content>flow content</a> other than other <code><a href=#the-style-element>style</a></code> elements and <a href=#inter-element-whitespace>inter-element whitespace</a>.</dd>
<dt>Content model:</dt>
<dd>Depends on the value of the <code title=attr-style-type><a href=#attr-style-type>type</a></code> attribute.</dd>
<dd>Depends on the value of the <code title=attr-style-type><a href=#attr-style-type>type</a></code> attribute, but must match requirements described in prose below.</dd>
<dt>Content attributes:</dt>
<dd><a href=#global-attributes>Global attributes</a></dd>
<dd><code title=attr-style-media><a href=#attr-style-media>media</a></code></dd>
Expand Down Expand Up @@ -12017,6 +12017,23 @@ <h4 id=the-style-element><span class=secno>4.2.6 </span>The <dfn><code>style</co
<code><a href=#the-style-element>style</a></code> block without a title does not inherit the title
of the parent element: it merely has no title.</p>

<p>The <code>textContent</code> of a <code><a href=#the-style-element>style</a></code> element must
match the <code title="">style</code> production in the following
ABNF, the character set for which is Unicode. <a href=#refsABNF>[ABNF]</a></p>

<pre>style = no-c-start *( "&lt;!--" no-c-end "--&gt;" no-c-start )
no-c-start = &lt;any string that doesn't contain the substring "&lt;!--" &gt;
no-c-end = &lt;any string that doesn't contain the substring "--&gt;" &gt;</pre>

<!-- Unmatched comment-like syntax is invalid on a temporary basis,
waiting for IE, WebKit, and Opera to fix their parsing bug
whereby such comments trigger a weird escape in which </style>
is ignored. Otherwise, parsing behaviour in those browsers
could differ substantially from the parsing behaviour of HTML5.
Once everyone follows the HTML5 spec, we can drop this
requirement.
-->

<div class=impl>

<p>All descendant elements must be processed, according to their
Expand Down Expand Up @@ -12893,18 +12910,18 @@ <h5 id=scriptingLanguages><span class=secno>4.3.1.1 </span>Scripting languages</

<h5 id=restrictions-for-contents-of-script-elements><span class=secno>4.3.1.2 </span><dfn title="script content restrictions">Restrictions for contents of <code>script</code> elements</dfn></h5>

<p>The contents of a <code><a href=#script>script</a></code> element must match the
<p>The <code>textContent</code> of a <code><a href=#script>script</a></code> element must match the
<code title="">script</code> production in the following ABNF, the
character set for which is Unicode. <a href=#refsABNF>[ABNF]</a></p>

<pre>script = data1 *( escape [ script-start data3 ] "--&gt;" data1 ) [ escape ]
escape = "&lt;!--" data2 *( script-start data3 script-end data2 )

data1 = &lt;any string that doesn't contain a substring that matches not-data1&gt;
not-data1 = script-end / "&lt;!--"
not-data1 = <!-- script-end / -->"&lt;!--" <!-- the script-end is redundant here since it would close the element -->

data2 = &lt;any string that doesn't contain a substring that matches not-data2&gt;
not-data2 = script-end / script-start / "--&gt;"
not-data2 = <!-- script-end / -->script-start / "--&gt;" <!-- the script-end is redundant here since it would close the element -->

data3 = &lt;any string that doesn't contain a substring that matches not-data3&gt;
not-data3 = script-end / "--&gt;"
Expand Down
25 changes: 21 additions & 4 deletions index
Expand Up @@ -11740,7 +11740,7 @@ people expect to have work and what is necessary.
<dd>If the <code title=attr-style-scoped><a href=#attr-style-scoped>scoped</a></code> attribute is absent: in a <code><a href=#the-noscript-element>noscript</a></code> element that is a child of a <code><a href=#the-head-element-0>head</a></code> element.</dd>
<dd>If the <code title=attr-style-scoped><a href=#attr-style-scoped>scoped</a></code> attribute is present: where <a href=#flow-content>flow content</a> is expected, but before any other <a href=#flow-content>flow content</a> other than other <code><a href=#the-style-element>style</a></code> elements and <a href=#inter-element-whitespace>inter-element whitespace</a>.</dd>
<dt>Content model:</dt>
<dd>Depends on the value of the <code title=attr-style-type><a href=#attr-style-type>type</a></code> attribute.</dd>
<dd>Depends on the value of the <code title=attr-style-type><a href=#attr-style-type>type</a></code> attribute, but must match requirements described in prose below.</dd>
<dt>Content attributes:</dt>
<dd><a href=#global-attributes>Global attributes</a></dd>
<dd><code title=attr-style-media><a href=#attr-style-media>media</a></code></dd>
Expand Down Expand Up @@ -11827,6 +11827,23 @@ people expect to have work and what is necessary.
<code><a href=#the-style-element>style</a></code> block without a title does not inherit the title
of the parent element: it merely has no title.</p>

<p>The <code>textContent</code> of a <code><a href=#the-style-element>style</a></code> element must
match the <code title="">style</code> production in the following
ABNF, the character set for which is Unicode. <a href=#refsABNF>[ABNF]</a></p>

<pre>style = no-c-start *( "&lt;!--" no-c-end "--&gt;" no-c-start )
no-c-start = &lt;any string that doesn't contain the substring "&lt;!--" &gt;
no-c-end = &lt;any string that doesn't contain the substring "--&gt;" &gt;</pre>

<!-- Unmatched comment-like syntax is invalid on a temporary basis,
waiting for IE, WebKit, and Opera to fix their parsing bug
whereby such comments trigger a weird escape in which </style>
is ignored. Otherwise, parsing behaviour in those browsers
could differ substantially from the parsing behaviour of HTML5.
Once everyone follows the HTML5 spec, we can drop this
requirement.
-->

<div class=impl>

<p>All descendant elements must be processed, according to their
Expand Down Expand Up @@ -12703,18 +12720,18 @@ o............A....e

<h5 id=restrictions-for-contents-of-script-elements><span class=secno>4.3.1.2 </span><dfn title="script content restrictions">Restrictions for contents of <code>script</code> elements</dfn></h5>

<p>The contents of a <code><a href=#script>script</a></code> element must match the
<p>The <code>textContent</code> of a <code><a href=#script>script</a></code> element must match the
<code title="">script</code> production in the following ABNF, the
character set for which is Unicode. <a href=#refsABNF>[ABNF]</a></p>

<pre>script = data1 *( escape [ script-start data3 ] "--&gt;" data1 ) [ escape ]
escape = "&lt;!--" data2 *( script-start data3 script-end data2 )

data1 = &lt;any string that doesn't contain a substring that matches not-data1&gt;
not-data1 = script-end / "&lt;!--"
not-data1 = <!-- script-end / -->"&lt;!--" <!-- the script-end is redundant here since it would close the element -->

data2 = &lt;any string that doesn't contain a substring that matches not-data2&gt;
not-data2 = script-end / script-start / "--&gt;"
not-data2 = <!-- script-end / -->script-start / "--&gt;" <!-- the script-end is redundant here since it would close the element -->

data3 = &lt;any string that doesn't contain a substring that matches not-data3&gt;
not-data3 = script-end / "--&gt;"
Expand Down
26 changes: 22 additions & 4 deletions source
Expand Up @@ -12411,7 +12411,7 @@ people expect to have work and what is necessary.
<dd>If the <code title="attr-style-scoped">scoped</code> attribute is absent: in a <code>noscript</code> element that is a child of a <code>head</code> element.</dd>
<dd>If the <code title="attr-style-scoped">scoped</code> attribute is present: where <span>flow content</span> is expected, but before any other <span>flow content</span> other than other <code>style</code> elements and <span>inter-element whitespace</span>.</dd>
<dt>Content model:</dt>
<dd>Depends on the value of the <code title="attr-style-type">type</code> attribute.</dd>
<dd>Depends on the value of the <code title="attr-style-type">type</code> attribute, but must match requirements described in prose below.</dd>
<dt>Content attributes:</dt>
<dd><span>Global attributes</span></dd>
<dd><code title="attr-style-media">media</code></dd>
Expand Down Expand Up @@ -12508,6 +12508,24 @@ people expect to have work and what is necessary.
<code>style</code> block without a title does not inherit the title
of the parent element: it merely has no title.</p>

<p>The <code>textContent</code> of a <code>style</code> element must
match the <code title="">style</code> production in the following
ABNF, the character set for which is Unicode. <a
href="#refsABNF">[ABNF]</a></p>

<pre>style = no-c-start *( "&lt;!--" no-c-end "-->" no-c-start )
no-c-start = &lt;any string that doesn't contain the substring "&lt;!--" >
no-c-end = &lt;any string that doesn't contain the substring "-->" ></pre>

<!-- Unmatched comment-like syntax is invalid on a temporary basis,
waiting for IE, WebKit, and Opera to fix their parsing bug
whereby such comments trigger a weird escape in which </style>
is ignored. Otherwise, parsing behaviour in those browsers
could differ substantially from the parsing behaviour of HTML5.
Once everyone follows the HTML5 spec, we can drop this
requirement.
-->

<div class="impl">

<p>All descendant elements must be processed, according to their
Expand Down Expand Up @@ -13517,7 +13535,7 @@ o............A....e

<h5><dfn title="script content restrictions">Restrictions for contents of <code>script</code> elements</dfn></h5>

<p>The contents of a <code>script</code> element must match the
<p>The <code>textContent</code> of a <code>script</code> element must match the
<code title="">script</code> production in the following ABNF, the
character set for which is Unicode. <a
href="#refsABNF">[ABNF]</a></p>
Expand All @@ -13526,10 +13544,10 @@ o............A....e
escape = "&lt;!--" data2 *( script-start data3 script-end data2 )

data1 = &lt;any string that doesn't contain a substring that matches not-data1>
not-data1 = script-end / "&lt;!--"
not-data1 = <!-- script-end / -->"&lt;!--" <!-- the script-end is redundant here since it would close the element -->

data2 = &lt;any string that doesn't contain a substring that matches not-data2>
not-data2 = script-end / script-start / "-->"
not-data2 = <!-- script-end / -->script-start / "-->" <!-- the script-end is redundant here since it would close the element -->

data3 = &lt;any string that doesn't contain a substring that matches not-data3>
not-data3 = script-end / "-->"
Expand Down

0 comments on commit 4fa68d0

Please sign in to comment.