Skip to content
Permalink
Browse files
[cgiowt] (3) Change how the form element pointer affects parsing <tem…
…plate> 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

git-svn-id: http://svn.whatwg.org/webapps@8331 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Dec 4, 2013
1 parent ca1c582 commit ec0ae343924a7a0e2479305cbafb9fe406c3a9fd
Showing with 148 additions and 63 deletions.
  1. +48 −21 complete.html
  2. +48 −21 index
  3. +52 −21 source
@@ -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 &mdash; Last Updated 3 December 2013</h2>
<h2 class="no-num no-toc">Living Standard &mdash; 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 @@ <h5 id=the-list-of-active-formatting-elements><span class=secno>12.2.3.3 </span>
<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 @@ <h6 id=the-before-head-insertion-mode><span class=secno>12.2.5.4.3 </span>The "<
<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 @@ <h6 id=the-before-head-insertion-mode><span class=secno>12.2.5.4.3 </span>The "<
<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 @@ <h6 id=the-before-head-insertion-mode><span class=secno>12.2.5.4.3 </span>The "<
<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 @@ <h6 id=the-before-head-insertion-mode><span class=secno>12.2.5.4.3 </span>The "<

<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 @@ <h6 id=the-before-head-insertion-mode><span class=secno>12.2.5.4.3 </span>The "<
<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 @@ <h6 id=the-before-head-insertion-mode><span class=secno>12.2.5.4.3 </span>The "<

<!-- 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 @@ <h6 id=parsing-main-incdata><span class=secno>12.2.5.4.8 </span>The "<dfn title=

<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 @@ <h3 id=serializing-html-fragments><span class=secno>12.3 </span>Serializing HTML

<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>

0 comments on commit ec0ae34

Please sign in to comment.