[html5] r8331 - [cgiowt] (3) Change how the form element pointer affects parsing <template> elem [...]

whatwg at whatwg.org whatwg at whatwg.org
Wed Dec 4 11:02:26 PST 2013


Author: ianh
Date: 2013-12-04 11:02:24 -0800 (Wed, 04 Dec 2013)
New Revision: 8331

Modified:
   complete.html
   index
   source
Log:
[cgiowt] (3) Change how the form element pointer affects parsing <template> elements, to reduce weirdness in templates (e.g. before you couldn't have a template that contained a form if it was itself inside a form).
Affected topics: HTML Syntax and Parsing

Modified: complete.html
===================================================================
--- complete.html	2013-12-03 22:58:15 UTC (rev 8330)
+++ complete.html	2013-12-04 19:02:24 UTC (rev 8331)
@@ -125,7 +125,7 @@
   </script><link rel=stylesheet href=http://www.whatwg.org/style/specification><link rel=icon href=http://www.whatwg.org/images/icon><style>
    .proposal { border: blue solid; padding: 1em; }
    .bad, .bad *:not(.XXX) { color: gray; border-color: gray; background: transparent; }
-   #updatesStatus { display: none; }
+   #updatesStatus { display: none; z-index: 10; }
    #updatesStatus.relevant { display: block; position: fixed; right: 1em; top: 1em; padding: 0.5em; font: bold small sans-serif; min-width: 25em; width: 30%; max-width: 40em; height: auto; border: ridge 4px gray; background: #EEEEEE; color: black; }
    div.head .logo { width: 11em; margin-bottom: 20em; }
    #configUI { position: absolute; z-index: 20; top: 10em; right: 0; width: 11em; padding: 0 0.5em 0 0.5em; font-size: small; background: gray; background: rgba(32,32,32,0.9); color: white; border-radius: 1em 0 0 1em; -moz-border-radius: 1em 0 0 1em; }
@@ -298,7 +298,7 @@
 
   <header class=head id=head><p><a href=http://www.whatwg.org/ class=logo><img width=101 src=/images/logo alt=WHATWG height=101></a></p>
    <hgroup><h1 class=allcaps>HTML</h1>
-    <h2 class="no-num no-toc">Living Standard — Last Updated 3 December 2013</h2>
+    <h2 class="no-num no-toc">Living Standard — Last Updated 4 December 2013</h2>
    </hgroup><dl><dt><strong>Web developer edition:</strong></dt>
     <dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
     <dt>Multiple-page version:</dt>
@@ -86026,7 +86026,7 @@
   <p>The <a href=#form-element-pointer><code title="">form</code> element pointer</a> points to the last
   <code><a href=#the-form-element>form</a></code> element that was opened and whose end tag has not yet been seen. It is used to
   make form controls associate with forms in the face of dramatically bad markup, for historical
-  reasons.</p>
+  reasons. It is ignored inside <code><a href=#the-template-element>template</a></code> elements.</p>
 
 
   <h5 id=other-parsing-state-flags><span class=secno>12.2.3.5 </span>Other parsing state flags</h5>
@@ -89374,7 +89374,8 @@
    <dt>A start tag whose tag name is "form"</dt>
    <dd>
 
-    <p>If the <a href=#form-element-pointer><code title=form>form</code> element pointer</a> is not null, then this is
+<!--CLEANUP-->
+    <p>If the <a href=#form-element-pointer><code title=form>form</code> element pointer</a> is not null, and there is no <code><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements>stack of open elements</a>, then this is
     a <a href=#parse-error>parse error</a>; ignore the token.</p>
 
     <p>Otherwise:</p>
@@ -89383,7 +89384,8 @@
     <code>p</code> element in button scope</a>, then <a href=#close-a-p-element>close a <code>p</code>
     element</a>.</p>
 
-    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token, and set the <a href=#form-element-pointer><code title=form>form</code> element pointer</a> to point to the element created.</p>
+<!--CLEANUP-->
+    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token, and, if there is no <code><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements>stack of open elements</a>, set the <a href=#form-element-pointer><code title=form>form</code> element pointer</a> to point to the element created.</p>
 
    </dd>
 
@@ -89580,23 +89582,41 @@
    <dt>An end tag whose tag name is "form"</dt>
    <dd>
 
-    <p>Let <var title="">node</var> be the element that the <a href=#form-element-pointer><code title="">form</code> element
-    pointer</a> is set to.</p>
+    <p>If there is no <code><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements>stack of open elements</a>, then
+    run these substeps:</p>
 
-    <p>Set the <a href=#form-element-pointer><code title="">form</code> element pointer</a> to null.</p>
+    <ol><li><p>Let <var title="">node</var> be the element that the <a href=#form-element-pointer><code title="">form</code>
+     element pointer</a> is set to, or null if it is not set to an element.</li>
 
-    <p>If <var title="">node</var> is null or the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-scope title="has an element in scope">have <var title="">node</var> in scope</a>, then this is a
-    <a href=#parse-error>parse error</a>; ignore the token.</p>
+     <li><p>Set the <a href=#form-element-pointer><code title="">form</code> element pointer</a> to null. Otherwise, let
+     <var title="">node</var> be null.</li>
 
-    <p>Otherwise, run these steps:</p>
+     <li><p>If <var title="">node</var> is null or if the <a href=#stack-of-open-elements>stack of open elements</a> does
+     not <a href=#has-an-element-in-scope title="has an element in scope">have <var title="">node</var> in scope</a>, then
+     this is a <a href=#parse-error>parse error</a>; abort these steps and ignore the token.</li>
 
-    <ol><li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>.</li>
+     <li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>.</li>
 
      <li><p>If the <a href=#current-node>current node</a> is not <var title="">node</var>, then this is a
      <a href=#parse-error>parse error</a>.</li>
 
      <li><p>Remove <var title="">node</var> from the <a href=#stack-of-open-elements>stack of open elements</a>.</li>
 
+    </ol><p>If there <em>is</em> a <code><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements>stack of open
+    elements</a>, then run these substeps instead:</p>
+
+    <ol><li><p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-scope title="has an element in
+     scope">have a <code>form</code> element in scope</a>, then this is a <a href=#parse-error>parse
+     error</a>; abort these steps and ignore the token.</li>
+
+     <li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>.</li>
+
+     <li><p>If the <a href=#current-node>current node</a> is not a <code><a href=#the-form-element>form</a></code> element, then this is a
+     <a href=#parse-error>parse error</a>.</li>
+
+     <li><p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a> until a <code><a href=#the-form-element>form</a></code>
+     element has been popped from the stack.</li>
+
     </ol></dd>
 
    <!-- as normal, except </p> implies <p> if there's no <p> in scope, and needs care as the elements have optional tags -->
@@ -89893,7 +89913,8 @@
 
     <p><a href=#parse-error>Parse error</a>.</p>
 
-    <p>If the <a href=#form-element-pointer><code title="">form</code> element pointer</a> is not null, then ignore the
+    <p>If there is no <code><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements>stack of open elements</a> and
+    the <a href=#form-element-pointer><code title="">form</code> element pointer</a> is not null, then ignore the
     token.</p>
 
     <p>Otherwise:</p>
@@ -89909,7 +89930,8 @@
     <code>p</code> element in button scope</a>, then <a href=#close-a-p-element>close a <code>p</code>
     element</a>.</p>
 
-    <p><a href=#insert-an-html-element>Insert an HTML element</a> for a "form" start tag token with no attributes, and set
+<!--CLEANUP-->
+    <p><a href=#insert-an-html-element>Insert an HTML element</a> for a "form" start tag token with no attributes, and, if there is no <code><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements>stack of open elements</a>, set
     the <a href=#form-element-pointer><code title=form>form</code> element pointer</a> to point to the element
     created.</p>
 
@@ -89947,7 +89969,8 @@
 
     <!-- fake </form> -->
     <p>Pop the <a href=#current-node>current node</a> (which will be the <code><a href=#the-form-element>form</a></code> element created
-    earlier) off the <a href=#stack-of-open-elements>stack of open elements</a>. Set the <a href=#form-element-pointer><code title=form>form</code> element pointer</a> to null.</p>
+    earlier) off the <a href=#stack-of-open-elements>stack of open elements</a>, and, if there is no <code><a href=#the-template-element>template</a></code>
+    element on the <a href=#stack-of-open-elements>stack of open elements</a>, set the <a href=#form-element-pointer><code title=form>form</code> element pointer</a> back to null.</p>
 
     <!-- explanation of text -->
     <p><dfn id=attr-isindex-prompt title=attr-isindex-prompt><strong>Prompt</strong></dfn>: If the token has an attribute
@@ -90660,8 +90683,9 @@
 
     <p><a href=#parse-error>Parse error</a>.</p>
 
-    <p>If the <a href=#form-element-pointer><code title=form>form</code> element pointer</a> is not null, ignore the
-    token.</p>
+    <p>If there is a <code><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements>stack of open elements</a>, or if
+    the <a href=#form-element-pointer><code title=form>form</code> element pointer</a> is not null, ignore the
+    token.</p> <!-- in a <template>, the <form> would have no effect and thus be a waste of time... -->
 
     <p>Otherwise:</p>
 
@@ -92848,10 +92872,13 @@
 
      <li>
 
-      <p>Set the parser's <a href=#form-element-pointer><code>form</code> element pointer</a> to the nearest node to the
-      <var title=concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var> element that is a <code><a href=#the-form-element>form</a></code>
-      element (going straight up the ancestor chain, and including the element itself, if it is a
-      <code><a href=#the-form-element>form</a></code> element), or, if there is no such <code><a href=#the-form-element>form</a></code> element, to null.</p>
+      <p>If neither the <var title=concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var> element nor any of
+      its ancestors are <code><a href=#the-template-element>template</a></code> elements, then set the parser's
+      <a href=#form-element-pointer><code>form</code> element pointer</a> to the nearest node to the <var title=concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var> element that is a <code><a href=#the-form-element>form</a></code> element
+      (going straight up the ancestor chain, and including the element itself, if it is a
+      <code><a href=#the-form-element>form</a></code> element), if any. (If there is no such <code><a href=#the-form-element>form</a></code> element, or if
+      there's a <code><a href=#the-template-element>template</a></code> element in the ancestor chain, the <a href=#form-element-pointer><code>form</code>
+      element pointer</a> keeps its initial value, null.)</p>
 
      </li>
 

Modified: index
===================================================================
--- index	2013-12-03 22:58:15 UTC (rev 8330)
+++ index	2013-12-04 19:02:24 UTC (rev 8331)
@@ -125,7 +125,7 @@
   </script><link rel=stylesheet href=http://www.whatwg.org/style/specification><link rel=icon href=http://www.whatwg.org/images/icon><style>
    .proposal { border: blue solid; padding: 1em; }
    .bad, .bad *:not(.XXX) { color: gray; border-color: gray; background: transparent; }
-   #updatesStatus { display: none; }
+   #updatesStatus { display: none; z-index: 10; }
    #updatesStatus.relevant { display: block; position: fixed; right: 1em; top: 1em; padding: 0.5em; font: bold small sans-serif; min-width: 25em; width: 30%; max-width: 40em; height: auto; border: ridge 4px gray; background: #EEEEEE; color: black; }
    div.head .logo { width: 11em; margin-bottom: 20em; }
    #configUI { position: absolute; z-index: 20; top: 10em; right: 0; width: 11em; padding: 0 0.5em 0 0.5em; font-size: small; background: gray; background: rgba(32,32,32,0.9); color: white; border-radius: 1em 0 0 1em; -moz-border-radius: 1em 0 0 1em; }
@@ -298,7 +298,7 @@
 
   <header class=head id=head><p><a href=http://www.whatwg.org/ class=logo><img width=101 src=/images/logo alt=WHATWG height=101></a></p>
    <hgroup><h1 class=allcaps>HTML</h1>
-    <h2 class="no-num no-toc">Living Standard — Last Updated 3 December 2013</h2>
+    <h2 class="no-num no-toc">Living Standard — Last Updated 4 December 2013</h2>
    </hgroup><dl><dt><strong>Web developer edition:</strong></dt>
     <dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
     <dt>Multiple-page version:</dt>
@@ -86026,7 +86026,7 @@
   <p>The <a href=#form-element-pointer><code title="">form</code> element pointer</a> points to the last
   <code><a href=#the-form-element>form</a></code> element that was opened and whose end tag has not yet been seen. It is used to
   make form controls associate with forms in the face of dramatically bad markup, for historical
-  reasons.</p>
+  reasons. It is ignored inside <code><a href=#the-template-element>template</a></code> elements.</p>
 
 
   <h5 id=other-parsing-state-flags><span class=secno>12.2.3.5 </span>Other parsing state flags</h5>
@@ -89374,7 +89374,8 @@
    <dt>A start tag whose tag name is "form"</dt>
    <dd>
 
-    <p>If the <a href=#form-element-pointer><code title=form>form</code> element pointer</a> is not null, then this is
+<!--CLEANUP-->
+    <p>If the <a href=#form-element-pointer><code title=form>form</code> element pointer</a> is not null, and there is no <code><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements>stack of open elements</a>, then this is
     a <a href=#parse-error>parse error</a>; ignore the token.</p>
 
     <p>Otherwise:</p>
@@ -89383,7 +89384,8 @@
     <code>p</code> element in button scope</a>, then <a href=#close-a-p-element>close a <code>p</code>
     element</a>.</p>
 
-    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token, and set the <a href=#form-element-pointer><code title=form>form</code> element pointer</a> to point to the element created.</p>
+<!--CLEANUP-->
+    <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token, and, if there is no <code><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements>stack of open elements</a>, set the <a href=#form-element-pointer><code title=form>form</code> element pointer</a> to point to the element created.</p>
 
    </dd>
 
@@ -89580,23 +89582,41 @@
    <dt>An end tag whose tag name is "form"</dt>
    <dd>
 
-    <p>Let <var title="">node</var> be the element that the <a href=#form-element-pointer><code title="">form</code> element
-    pointer</a> is set to.</p>
+    <p>If there is no <code><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements>stack of open elements</a>, then
+    run these substeps:</p>
 
-    <p>Set the <a href=#form-element-pointer><code title="">form</code> element pointer</a> to null.</p>
+    <ol><li><p>Let <var title="">node</var> be the element that the <a href=#form-element-pointer><code title="">form</code>
+     element pointer</a> is set to, or null if it is not set to an element.</li>
 
-    <p>If <var title="">node</var> is null or the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-scope title="has an element in scope">have <var title="">node</var> in scope</a>, then this is a
-    <a href=#parse-error>parse error</a>; ignore the token.</p>
+     <li><p>Set the <a href=#form-element-pointer><code title="">form</code> element pointer</a> to null. Otherwise, let
+     <var title="">node</var> be null.</li>
 
-    <p>Otherwise, run these steps:</p>
+     <li><p>If <var title="">node</var> is null or if the <a href=#stack-of-open-elements>stack of open elements</a> does
+     not <a href=#has-an-element-in-scope title="has an element in scope">have <var title="">node</var> in scope</a>, then
+     this is a <a href=#parse-error>parse error</a>; abort these steps and ignore the token.</li>
 
-    <ol><li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>.</li>
+     <li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>.</li>
 
      <li><p>If the <a href=#current-node>current node</a> is not <var title="">node</var>, then this is a
      <a href=#parse-error>parse error</a>.</li>
 
      <li><p>Remove <var title="">node</var> from the <a href=#stack-of-open-elements>stack of open elements</a>.</li>
 
+    </ol><p>If there <em>is</em> a <code><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements>stack of open
+    elements</a>, then run these substeps instead:</p>
+
+    <ol><li><p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-scope title="has an element in
+     scope">have a <code>form</code> element in scope</a>, then this is a <a href=#parse-error>parse
+     error</a>; abort these steps and ignore the token.</li>
+
+     <li><p><a href=#generate-implied-end-tags>Generate implied end tags</a>.</li>
+
+     <li><p>If the <a href=#current-node>current node</a> is not a <code><a href=#the-form-element>form</a></code> element, then this is a
+     <a href=#parse-error>parse error</a>.</li>
+
+     <li><p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a> until a <code><a href=#the-form-element>form</a></code>
+     element has been popped from the stack.</li>
+
     </ol></dd>
 
    <!-- as normal, except </p> implies <p> if there's no <p> in scope, and needs care as the elements have optional tags -->
@@ -89893,7 +89913,8 @@
 
     <p><a href=#parse-error>Parse error</a>.</p>
 
-    <p>If the <a href=#form-element-pointer><code title="">form</code> element pointer</a> is not null, then ignore the
+    <p>If there is no <code><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements>stack of open elements</a> and
+    the <a href=#form-element-pointer><code title="">form</code> element pointer</a> is not null, then ignore the
     token.</p>
 
     <p>Otherwise:</p>
@@ -89909,7 +89930,8 @@
     <code>p</code> element in button scope</a>, then <a href=#close-a-p-element>close a <code>p</code>
     element</a>.</p>
 
-    <p><a href=#insert-an-html-element>Insert an HTML element</a> for a "form" start tag token with no attributes, and set
+<!--CLEANUP-->
+    <p><a href=#insert-an-html-element>Insert an HTML element</a> for a "form" start tag token with no attributes, and, if there is no <code><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements>stack of open elements</a>, set
     the <a href=#form-element-pointer><code title=form>form</code> element pointer</a> to point to the element
     created.</p>
 
@@ -89947,7 +89969,8 @@
 
     <!-- fake </form> -->
     <p>Pop the <a href=#current-node>current node</a> (which will be the <code><a href=#the-form-element>form</a></code> element created
-    earlier) off the <a href=#stack-of-open-elements>stack of open elements</a>. Set the <a href=#form-element-pointer><code title=form>form</code> element pointer</a> to null.</p>
+    earlier) off the <a href=#stack-of-open-elements>stack of open elements</a>, and, if there is no <code><a href=#the-template-element>template</a></code>
+    element on the <a href=#stack-of-open-elements>stack of open elements</a>, set the <a href=#form-element-pointer><code title=form>form</code> element pointer</a> back to null.</p>
 
     <!-- explanation of text -->
     <p><dfn id=attr-isindex-prompt title=attr-isindex-prompt><strong>Prompt</strong></dfn>: If the token has an attribute
@@ -90660,8 +90683,9 @@
 
     <p><a href=#parse-error>Parse error</a>.</p>
 
-    <p>If the <a href=#form-element-pointer><code title=form>form</code> element pointer</a> is not null, ignore the
-    token.</p>
+    <p>If there is a <code><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements>stack of open elements</a>, or if
+    the <a href=#form-element-pointer><code title=form>form</code> element pointer</a> is not null, ignore the
+    token.</p> <!-- in a <template>, the <form> would have no effect and thus be a waste of time... -->
 
     <p>Otherwise:</p>
 
@@ -92848,10 +92872,13 @@
 
      <li>
 
-      <p>Set the parser's <a href=#form-element-pointer><code>form</code> element pointer</a> to the nearest node to the
-      <var title=concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var> element that is a <code><a href=#the-form-element>form</a></code>
-      element (going straight up the ancestor chain, and including the element itself, if it is a
-      <code><a href=#the-form-element>form</a></code> element), or, if there is no such <code><a href=#the-form-element>form</a></code> element, to null.</p>
+      <p>If neither the <var title=concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var> element nor any of
+      its ancestors are <code><a href=#the-template-element>template</a></code> elements, then set the parser's
+      <a href=#form-element-pointer><code>form</code> element pointer</a> to the nearest node to the <var title=concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var> element that is a <code><a href=#the-form-element>form</a></code> element
+      (going straight up the ancestor chain, and including the element itself, if it is a
+      <code><a href=#the-form-element>form</a></code> element), if any. (If there is no such <code><a href=#the-form-element>form</a></code> element, or if
+      there's a <code><a href=#the-template-element>template</a></code> element in the ancestor chain, the <a href=#form-element-pointer><code>form</code>
+      element pointer</a> keeps its initial value, null.)</p>
 
      </li>
 

Modified: source
===================================================================
--- source	2013-12-03 22:58:15 UTC (rev 8330)
+++ source	2013-12-04 19:02:24 UTC (rev 8331)
@@ -95739,7 +95739,7 @@
   <p>The <span><code data-x="">form</code> element pointer</span> points to the last
   <code>form</code> element that was opened and whose end tag has not yet been seen. It is used to
   make form controls associate with forms in the face of dramatically bad markup, for historical
-  reasons.</p>
+  reasons. It is ignored inside <code>template</code> elements.</p>
 
 
   <h5>Other parsing state flags</h5>
@@ -99581,7 +99581,8 @@
    <dt>A start tag whose tag name is "form"</dt>
    <dd>
 
-    <p>If the <span><code data-x="form">form</code> element pointer</span> is not null, then this is
+<!--CLEANUP-->
+    <p>If the <span><code data-x="form">form</code> element pointer</span> is not null, and there is no <code>template</code> element on the <span>stack of open elements</span>, then this is
     a <span>parse error</span>; ignore the token.</p>
 
     <p>Otherwise:</p>
@@ -99590,7 +99591,8 @@
     <code>p</code> element in button scope</span>, then <span>close a <code>p</code>
     element</span>.</p>
 
-    <p><span>Insert an HTML element</span> for the token, and set the <span><code
+<!--CLEANUP-->
+    <p><span>Insert an HTML element</span> for the token, and, if there is no <code>template</code> element on the <span>stack of open elements</span>, set the <span><code
     data-x="form">form</code> element pointer</span> to point to the element created.</p>
 
    </dd>
@@ -99823,18 +99825,20 @@
    <dt>An end tag whose tag name is "form"</dt>
    <dd>
 
-    <p>Let <var data-x="">node</var> be the element that the <span><code data-x="">form</code> element
-    pointer</span> is set to.</p>
+    <p>If there is no <code>template</code> element on the <span>stack of open elements</span>, then
+    run these substeps:</p>
 
-    <p>Set the <span><code data-x="">form</code> element pointer</span> to null.</p>
+    <ol>
 
-    <p>If <var data-x="">node</var> is null or the <span>stack of open elements</span> does not <span
-    data-x="has an element in scope">have <var data-x="">node</var> in scope</span>, then this is a
-    <span>parse error</span>; ignore the token.</p>
+     <li><p>Let <var data-x="">node</var> be the element that the <span><code data-x="">form</code>
+     element pointer</span> is set to, or null if it is not set to an element.</p></li>
 
-    <p>Otherwise, run these steps:</p>
+     <li><p>Set the <span><code data-x="">form</code> element pointer</span> to null. Otherwise, let
+     <var data-x="">node</var> be null.</p></li>
 
-    <ol>
+     <li><p>If <var data-x="">node</var> is null or if the <span>stack of open elements</span> does
+     not <span data-x="has an element in scope">have <var data-x="">node</var> in scope</span>, then
+     this is a <span>parse error</span>; abort these steps and ignore the token.</p></li>
 
      <li><p><span>Generate implied end tags</span>.</p></li>
 
@@ -99845,6 +99849,25 @@
 
     </ol>
 
+    <p>If there <em>is</em> a <code>template</code> element on the <span>stack of open
+    elements</span>, then run these substeps instead:</p>
+
+    <ol>
+
+     <li><p>If the <span>stack of open elements</span> does not <span data-x="has an element in
+     scope">have a <code>form</code> element in scope</span>, then this is a <span>parse
+     error</span>; abort these steps and ignore the token.</p></li>
+
+     <li><p><span>Generate implied end tags</span>.</p></li>
+
+     <li><p>If the <span>current node</span> is not a <code>form</code> element, then this is a
+     <span>parse error</span>.</p></li>
+
+     <li><p>Pop elements from the <span>stack of open elements</span> until a <code>form</code>
+     element has been popped from the stack.</p></li>
+
+    </ol>
+
    </dd>
 
    <!-- as normal, except </p> implies <p> if there's no <p> in scope, and needs care as the elements have optional tags -->
@@ -100158,7 +100181,8 @@
 
     <p><span>Parse error</span>.</p>
 
-    <p>If the <span><code data-x="">form</code> element pointer</span> is not null, then ignore the
+    <p>If there is no <code>template</code> element on the <span>stack of open elements</span> and
+    the <span><code data-x="">form</code> element pointer</span> is not null, then ignore the
     token.</p>
 
     <p>Otherwise:</p>
@@ -100174,7 +100198,8 @@
     <code>p</code> element in button scope</span>, then <span>close a <code>p</code>
     element</span>.</p>
 
-    <p><span>Insert an HTML element</span> for a "form" start tag token with no attributes, and set
+<!--CLEANUP-->
+    <p><span>Insert an HTML element</span> for a "form" start tag token with no attributes, and, if there is no <code>template</code> element on the <span>stack of open elements</span>, set
     the <span><code data-x="form">form</code> element pointer</span> to point to the element
     created.</p>
 
@@ -100217,8 +100242,9 @@
 
     <!-- fake </form> -->
     <p>Pop the <span>current node</span> (which will be the <code>form</code> element created
-    earlier) off the <span>stack of open elements</span>. Set the <span><code
-    data-x="form">form</code> element pointer</span> to null.</p>
+    earlier) off the <span>stack of open elements</span>, and, if there is no <code>template</code>
+    element on the <span>stack of open elements</span>, set the <span><code
+    data-x="form">form</code> element pointer</span> back to null.</p>
 
     <!-- explanation of text -->
     <p><dfn data-x="attr-isindex-prompt"><strong>Prompt</strong></dfn>: If the token has an attribute
@@ -100997,8 +101023,9 @@
 
     <p><span>Parse error</span>.</p>
 
-    <p>If the <span><code data-x="form">form</code> element pointer</span> is not null, ignore the
-    token.</p>
+    <p>If there is a <code>template</code> element on the <span>stack of open elements</span>, or if
+    the <span><code data-x="form">form</code> element pointer</span> is not null, ignore the
+    token.</p> <!-- in a <template>, the <form> would have no effect and thus be a waste of time... -->
 
     <p>Otherwise:</p>
 
@@ -103429,10 +103456,14 @@
 
      <li>
 
-      <p>Set the parser's <span><code>form</code> element pointer</span> to the nearest node to the
-      <var data-x="concept-frag-parse-context">context</var> element that is a <code>form</code>
-      element (going straight up the ancestor chain, and including the element itself, if it is a
-      <code>form</code> element), or, if there is no such <code>form</code> element, to null.</p>
+      <p>If neither the <var data-x="concept-frag-parse-context">context</var> element nor any of
+      its ancestors are <code>template</code> elements, then set the parser's
+      <span><code>form</code> element pointer</span> to the nearest node to the <var
+      data-x="concept-frag-parse-context">context</var> element that is a <code>form</code> element
+      (going straight up the ancestor chain, and including the element itself, if it is a
+      <code>form</code> element), if any. (If there is no such <code>form</code> element, or if
+      there's a <code>template</code> element in the ancestor chain, the <span><code>form</code>
+      element pointer</span> keeps its initial value, null.)</p>
 
      </li>
 




More information about the Commit-Watchers mailing list