W3C home > Mailing lists > Public > public-html-commits@w3.org > October 2010

html5/spec Overview.html,1.4513,1.4514

From: Ian Hickson via cvs-syncmail <cvsmail@w3.org>
Date: Fri, 15 Oct 2010 22:56:24 +0000
To: public-html-commits@w3.org
Message-Id: <E1P6tCL-0005IX-1p@lionel-hutz.w3.org>
Update of /sources/public/html5/spec
In directory hutz:/tmp/cvs-serv20349

Modified Files:
	Overview.html 
Log Message:
Add in some hard-coded limits for dealing with unclosed formatting elements to limit the explosive growth of the list of formatting elements in commonly-seen cases. (whatwg r5638)

Index: Overview.html
===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.4513
retrieving revision 1.4514
diff -u -d -r1.4513 -r1.4514
--- Overview.html	15 Oct 2010 21:53:03 -0000	1.4513
+++ Overview.html	15 Oct 2010 22:56:18 -0000	1.4514
@@ -1242,7 +1242,8 @@
        <li><a href="#misnested-tags:-b-i-b-i"><span class="secno">8.2.8.1 </span>Misnested tags: &lt;b&gt;&lt;i&gt;&lt;/b&gt;&lt;/i&gt;</a></li>
        <li><a href="#misnested-tags:-b-p-b-p"><span class="secno">8.2.8.2 </span>Misnested tags: &lt;b&gt;&lt;p&gt;&lt;/b&gt;&lt;/p&gt;</a></li>
        <li><a href="#unexpected-markup-in-tables"><span class="secno">8.2.8.3 </span>Unexpected markup in tables</a></li>
-       <li><a href="#scripts-that-modify-the-page-as-it-is-being-parsed"><span class="secno">8.2.8.4 </span>Scripts that modify the page as it is being parsed</a></ol></ol></li>
+       <li><a href="#scripts-that-modify-the-page-as-it-is-being-parsed"><span class="secno">8.2.8.4 </span>Scripts that modify the page as it is being parsed</a></li>
+       <li><a href="#unclosed-formatting-elements"><span class="secno">8.2.8.5 </span>Unclosed formatting elements</a></ol></ol></li>
    <li><a href="#serializing-html-fragments"><span class="secno">8.3 </span>Serializing HTML fragments</a></li>
    <li><a href="#parsing-html-fragments"><span class="secno">8.4 </span>Parsing HTML fragments</a></li>
    <li><a href="#named-character-references"><span class="secno">8.5 </span>Named character references</a></ol></li>
@@ -56354,7 +56355,28 @@
   created, so that further elements can be created for that token if
   necessary.</p>
 
-  <p>When the steps below require the UA to <dfn id="reconstruct-the-active-formatting-elements">reconstruct the
+  <p>When the steps below require the UA to <dfn id="push-onto-the-list-of-active-formatting-elements">push onto the list of
+  active formatting elements</dfn> an element <var title="">element</var>, the UA must perform the following steps:</p>
+
+  <ol><li><p>If there are already three elements in the <a href="#list-of-active-formatting-elements">list of
+   active formatting elements</a> after the last list marker, if
+   any, or anywhere in the list if there are no list markers, that
+   have the same tag name, namespace, and attributes as <var title="">element</var>, then remove the earliest such element from
+   the <a href="#list-of-active-formatting-elements">list of active formatting elements</a>. For these
+   purposes, the attributes must be compared as they were when the
+   elements were created by the parser; two elements have the same
+   attributes if all their parsed attributes can be paired such that
+   the two attributes in each pair have identical names, namespaces,
+   and values (the order of the attributes does not matter).</p>
+
+   <p class="note">This is the Noah's Ark clause. But with three per
+   family instead of two.</li> <!-- A sort of polyamorous Noah's
+   Ark, if you will. -->
+
+   <li><p>Add <var title="">element</var> to the <a href="#list-of-active-formatting-elements">list of active
+   formatting elements</a>.</li>
+
+  </ol><p>When the steps below require the UA to <dfn id="reconstruct-the-active-formatting-elements">reconstruct the
   active formatting elements</dfn>, the UA must perform the following
   steps:</p>
 
@@ -60035,9 +60057,9 @@
     <p><a href="#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
     any.</p>
 
-    <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token. Add that
-    element to the <a href="#list-of-active-formatting-elements">list of active formatting
-    elements</a>.</p>
+    <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token. <a href="#push-onto-the-list-of-active-formatting-elements">Push
+    onto the list of active formatting elements</a> that
+    element.</p>
 
    </dd>
 
@@ -60048,9 +60070,9 @@
     <p><a href="#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
     any.</p>
 
-    <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token. Add that
-    element to the <a href="#list-of-active-formatting-elements">list of active formatting
-    elements</a>.</p>
+    <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token. <a href="#push-onto-the-list-of-active-formatting-elements">Push
+    onto the list of active formatting elements</a> that
+    element.</p>
 
    </dd>
 
@@ -60067,9 +60089,9 @@
     <a href="#reconstruct-the-active-formatting-elements">reconstruct the active formatting elements</a>, if
     any.</p>
 
-    <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token. Add that
-    element to the <a href="#list-of-active-formatting-elements">list of active formatting
-    elements</a>.</p>
+    <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token. <a href="#push-onto-the-list-of-active-formatting-elements">Push
+    onto the list of active formatting elements</a> that
+    element.</p>
 
    </dd>
 
@@ -60092,16 +60114,20 @@
 
        <li>has the same tag name as the token.</li>
 
-      </ul><p>If there is no such node, or, if that node is also in the
-      <a href="#stack-of-open-elements">stack of open elements</a> but the element is not <a href="#has-an-element-in-scope" title="has an element in scope">in scope</a>, then this is a
-      <a href="#parse-error">parse error</a>; ignore the token, and abort these
-      steps.</p>
+      </ul><p>If there is no such node, then abort these steps and instead
+      act as described in the "any other end tag" entry below.</p>
 
       <p>Otherwise, if there is such a node, but that node is not
       in the <a href="#stack-of-open-elements">stack of open elements</a>, then this is a
       <a href="#parse-error">parse error</a>; remove the element from the list,
       and abort these steps.</p>
 
+      <p>Otherwise, if there is such a node, and that node is also in
+      the <a href="#stack-of-open-elements">stack of open elements</a>, but the element is not
+      <a href="#has-an-element-in-scope" title="has an element in scope">in scope</a>, then this
+      is a <a href="#parse-error">parse error</a>; ignore the token, and abort these
+      steps.</p>
+
       <p>Otherwise, there is a <var title="">formatting
       element</var> and that element is in <a href="#stack-of-open-elements" title="stack of
       open elements">the stack</a> and is <a href="#has-an-element-in-scope" title="has an
@@ -62626,6 +62652,36 @@
   <ul class="domTree"><li class="t1"><code><a href="#the-html-element-0">html</a></code><ul><li class="t1"><code><a href="#the-head-element-0">head</a></code><li class="t1"><code><a href="#the-body-element-0">body</a></code><ul><li class="t1"><code><a href="#script">script</a></code><ul><li class="t3"><code>#text</code>: <span title="">alert(document.URL);</span></ul></ul></ul></ul><p>This second alert will say "http://example.com/inner".</p>
 
 
+  <h5 id="unclosed-formatting-elements"><span class="secno">8.2.8.5 </span>Unclosed formatting elements</h5>
+
+  <p><i>This section is non-normative.</i></p>
+
+  <p>The following markup shows how nested formatting elements (such
+  as <code><a href="#the-b-element">b</a></code>) get collected and continue to be applied even as
+  the elements they are contained in are closed, but that excessive
+  duplicates are thrown away.</p>
+
+  <pre>&lt;!DOCTYPE html&gt;
+&lt;p&gt;&lt;b class=x&gt;&lt;b class=x&gt;&lt;b&gt;&lt;b class=x&gt;&lt;b class=x&gt;&lt;b&gt;X
+&lt;p&gt;X
+&lt;p&gt;&lt;b&gt;&lt;b class=x&gt;&lt;b&gt;X
+&lt;p&gt;&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;X</pre>
+
+  <p>The resulting DOM tree is as follows:</p>
+
+  <ul class="domTree"><li class="t10">DOCTYPE: <code><a href="#the-html-element-0">html</a></code><li class="t1"><code><a href="#the-html-element-0">html</a></code><ul><li class="t1"><code><a href="#the-head-element-0">head</a></code><li class="t1"><code><a href="#the-body-element-0">body</a></code><ul><li class="t1"><code><a href="#the-p-element">p</a></code><ul><li class="t1"><code><a href="#the-b-element">b</a></code> <span class="t2" title=""><code class="attribute name">class</code>="<code class="attribute value">x</code>"</span><ul><li class="t1"><code><a href="#the-b-element">b</a></code> <span class="t2" title=""><code class="attribute name">class</code>="<code class="attribute value">x</code>"</span><ul><li class="t1"><code><a href="#the-b-element">b</a></code><ul><li class="t1"><code><a href="#the-b-element">b</a></code> <span class="t2" title=""><code class="attribute name">class</code>="<code class="attribute value">x</code>"</span><ul><li class="t1"><code><a href="#the-b-element">b</a></code> <span class="t2" title=""><code class="attribute name">class</code>="<code class="attribute value">x</code>"</span><ul><li class="t1"><code><a href="#the-b-element">b</a></code><ul><li class="t3"><code>#text</code>: <span title="">X&#9166;</span></ul></ul></ul></ul></ul></ul></ul><li class="t1"><code><a href="#the-p-element">p</a></code><ul><li class="t1"><code><a href="#the-b-element">b</a></code> <span class="t2" title=""><code class="attribute name">class</code>="<code class="attribute value">x</code>"</span><ul><li class="t1"><code><a href="#the-b-element">b</a></code><ul><li class="t1"><code><a href="#the-b-element">b</a></code> <span class="t2" title=""><code class="attribute name">class</code>="<code class="attribute value">x</code>"</span><ul><li class="t1"><code><a href="#the-b-element">b</a></code> <span class="t2" title=""><code class="attribute name">class</code>="<code class="attribute value">x</code>"</span><ul><li class="t1"><code><a href="#the-b-element">b</a></code><ul><li class="t3"><code>#text</code>: <span title="">X&#9166;</span></ul></ul></ul></ul></ul></ul><li class="t1"><code><a href="#the-p-element">p</a></code><ul><li class="t1"><code><a href="#the-b-element">b</a></code> <span class="t2" title=""><code class="attribute name">class</code>="<code class="attribute value">x</code>"</span><ul><li class="t1"><code><a href="#the-b-element">b</a></code><ul><li class="t1"><code><a href="#the-b-element">b</a></code> <span class="t2" title=""><code class="attribute name">class</code>="<code class="attribute value">x</code>"</span><ul><li class="t1"><code><a href="#the-b-element">b</a></code> <span class="t2" title=""><code class="attribute name">class</code>="<code class="attribute value">x</code>"</span><ul><li class="t1"><code><a href="#the-b-element">b</a></code><ul><li class="t1"><code><a href="#the-b-element">b</a></code><ul><li class="t1"><code><a href="#the-b-element">b</a></code> <span class="t2" title=""><code class="attribute name">class</code>="<code class="attribute value">x</code>"</span><ul><li class="t1"><code><a href="#the-b-element">b</a></code><ul><li class="t3"><code>#text</code>: <span title="">X&#9166;</span></ul></ul></ul></ul></ul></ul></ul></ul></ul><li class="t1"><code><a href="#the-p-element">p</a></code><ul><li class="t3"><code>#text</code>: <span title="">X&#9166;</span></ul></ul></ul></ul><p>Note how the second <code><a href="#the-p-element">p</a></code> element in the markup has no
+  explicit <code><a href="#the-b-element">b</a></code> elements, but in the resulting DOM, up to
+  three of each kind of formatting element (in this case three
+  <code><a href="#the-b-element">b</a></code> elements with the class attribute, and two unadorned
+  <code><a href="#the-b-element">b</a></code> elements) get reconstructed before the element's
+  "X".</p>
+
+  <p>Also note how this means that in the final paragraph only six
+  <code><a href="#the-b-element">b</a></code> end tags are needed to completely clear the list of
+  formatting elements, even though nine <code><a href="#the-b-element">b</a></code> start tags have
+  been seen up to this point.</p>
+
+
 
 
   <h3 id="serializing-html-fragments"><span class="secno">8.3 </span>Serializing HTML fragments</h3>
Received on Friday, 15 October 2010 22:56:26 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 15 October 2010 22:56:38 GMT