HTML Standard Tracker

Diff (omit for latest revision)
Filter

Short URL: http://html5.org/r/2157

File a bug

SVNBugCommentTime (UTC)
2157WF2: Defining form=, .form, and the form element pointer. Also, s/initialise/initialize/.2008-09-07 11:15
Index: source
===================================================================
--- source	(revision 2156)
+++ source	(revision 2157)
@@ -4160,7 +4160,7 @@
    algorithm, to wait until the first 512 bytes of the resource are
    available.</p></li>
 
-   <li><p>Initialise <var title="">pos</var> to 0.</p></li>
+   <li><p>Initialize <var title="">pos</var> to 0.</p></li>
 
    <li><p>If <span><var title="">s</var>[0]</span> is 0xEF, <span><var
    title="">s</var>[1]</span> is 0xBB, and <span><var
@@ -23935,18 +23935,19 @@
   <dl class="element">
    <dt>Categories</dt>
    <dd><span>Flow content</span>.</dd>
+   <dd><span>Form-associated element</span>.</dd>
    <dt>Contexts in which this element may be used:</dt>
    <dd>Where <span>flow content</span> is expected.</dd>
    <dt>Content model:</dt>
    <dd><span>Flow content</span>.</dd>
    <dt>Element-specific attributes:</dt>
    <dd><code title="attr-fieldset-disabled">disabled</code></dd>
-   <dd><code title="attr-fieldset-form">form</code></dd>
+   <dd><code title="attr-fae-form">form</code></dd>
    <dt>DOM interface:</dt>
    <dd>
 <pre class="idl">interface <dfn>HTMLFieldSetElement</dfn> : <span>HTMLElement</span> {
            attribute DOMString <span title="dom-fieldset-disabled">disabled</span>;
-  readonly attribute <span>HTMLFormElement</span> <span title="dom-fieldset-form">form</span>;
+  readonly attribute <span>HTMLFormElement</span> <span title="dom-fae-form">form</span>;
 
   readonly attribute DOMString <span title="dom-select-type">type</span>;
 
@@ -23970,6 +23971,7 @@
    <dt>Categories</dt>
    <dd><span>Phrasing content</span>.</dd>
    <dd><span>Interactive content</span>.</dd>
+   <dd><span>Form-associated element</span>.</dd>
    <dt>Contexts in which this element may be used:</dt>
    <dd>Where <span>phrasing content</span> is expected.</dd>
    <dt>Content model:</dt>
@@ -23983,7 +23985,7 @@
    <dd><code title="attr-input-checked">checked</code></dd>
    <dd><code title="attr-input-disabled">disabled</code></dd>
    <dd><code title="attr-input-enctype">enctype</code></dd>
-   <dd><code title="attr-input-form">form</code></dd>
+   <dd><code title="attr-fae-form">form</code></dd>
    <dd><code title="attr-input-inputmode">inputmode</code></dd>
    <dd><code title="attr-input-list">list</code></dd>
    <dd><code title="attr-input-max">max</code></dd>
@@ -24012,7 +24014,7 @@
            attribute boolean <span title="dom-input-checked">checked</span>;
            attribute boolean <span title="dom-input-disabled">disabled</span>;
            attribute DOMString <span title="dom-input-enctype">enctype</span>;
-  readonly attribute <span>HTMLFormElement</span> <span title="dom-input-form">form</span>;
+  readonly attribute <span>HTMLFormElement</span> <span title="dom-fae-form">form</span>;
            attribute DOMString <span title="dom-input-inputmode">inputmode</span>;
   readonly attribute <span>HTMLElement</span> <span title="dom-input-list">list</span>;
            attribute DOMString <span title="dom-input-max">max</span>;
@@ -24062,6 +24064,7 @@
    <dt>Categories</dt>
    <dd><span>Phrasing content</span>.</dd>
    <dd><span>Interactive content</span>.</dd>
+   <dd><span>Form-associated element</span>.</dd>
    <dt>Contexts in which this element may be used:</dt>
    <dd>Where <span>phrasing content</span> is expected.</dd>
    <dt>Content model:</dt>
@@ -24071,7 +24074,7 @@
    <dd><code title="attr-button-autofocus">autofocus</code></dd>
    <dd><code title="attr-button-disabled">disabled</code></dd>
    <dd><code title="attr-button-enctype">enctype</code></dd>
-   <dd><code title="attr-button-form">form</code></dd>
+   <dd><code title="attr-fae-form">form</code></dd>
    <dd><code title="attr-button-method">method</code></dd>
    <dd><code title="attr-button-name">name</code></dd>
    <dd><code title="attr-button-target">target</code></dd>
@@ -24084,7 +24087,7 @@
            attribute boolean <span title="dom-button-autofocus">autofocus</span>;
            attribute boolean <span title="dom-button-disabled">disabled</span>;
            attribute DOMString <span title="dom-button-enctype">enctype</span>;
-  readonly attribute <span>HTMLFormElement</span> <span title="dom-button-form">form</span>;
+  readonly attribute <span>HTMLFormElement</span> <span title="dom-fae-form">form</span>;
            attribute DOMString <span title="dom-button-method">method</span>;
            attribute DOMString <span title="dom-button-name">name</span>;
            attribute DOMString <span title="dom-button-target">target</span>;
@@ -24111,17 +24114,18 @@
    <dt>Categories</dt>
    <dd><span>Phrasing content</span>.</dd>
    <dd><span>Interactive content</span>.</dd>
+   <dd><span>Form-associated element</span>.</dd>
    <dt>Contexts in which this element may be used:</dt>
    <dd>Where <span>phrasing content</span> is expected.</dd>
    <dt>Content model:</dt>
    <dd><span>Phrasing content</span>.</dd>
    <dt>Element-specific attributes:</dt>
-   <dd><code title="attr-label-form">form</code></dd>
+   <dd><code title="attr-fae-form">form</code></dd>
    <dd><code title="attr-label-for">for</code></dd>
    <dt>DOM interface:</dt>
    <dd>
 <pre class="idl">interface <dfn>HTMLLabelElement</dfn> : <span>HTMLElement</span> {
-  readonly attribute <span>HTMLFormElement</span> <span title="dom-label-form">form</span>;
+  readonly attribute <span>HTMLFormElement</span> <span title="dom-fae-form">form</span>;
            attribute DOMString <span title="dom-label-htmlFor">htmlFor</span>;
   readonly attribute <span>HTMLElement</span> <span title="dom-label-control">control</span>;
 };</pre>
@@ -24137,6 +24141,7 @@
    <dt>Categories</dt>
    <dd><span>Phrasing content</span>.</dd>
    <dd><span>Interactive content</span>.</dd>
+   <dd><span>Form-associated element</span>.</dd>
    <dt>Contexts in which this element may be used:</dt>
    <dd>Where <span>phrasing content</span> is expected.</dd>
    <dt>Content model:</dt>
@@ -24144,7 +24149,7 @@
    <dt>Element-specific attributes:</dt>
    <dd><code title="attr-select-autofocus">autofocus</code></dd>
    <dd><code title="attr-select-disabled">disabled</code></dd>
-   <dd><code title="attr-select-form">form</code></dd>
+   <dd><code title="attr-fae-form">form</code></dd>
    <dd><code title="attr-select-multiple">multiple</code></dd>
    <dd><code title="attr-select-name">name</code></dd>
    <dd><code title="attr-select-size">size</code></dd>
@@ -24153,7 +24158,7 @@
 <pre class="idl">interface <dfn>HTMLSelectElement</dfn> : <span>HTMLElement</span> {
            attribute boolean <span title="dom-select-autofocus">autofocus</span>;
            attribute boolean <span title="dom-select-disabled">disabled</span>;
-  readonly attribute <span>HTMLFormElement</span> <span title="dom-select-form">form</span>;
+  readonly attribute <span>HTMLFormElement</span> <span title="dom-fae-form">form</span>;
            attribute boolean <span title="dom-select-multiple">multiple</span>;
            attribute DOMString <span title="dom-select-name">name</span>;
            attribute boolean <span title="dom-select-size">size</span>;
@@ -24287,6 +24292,7 @@
    <dt>Categories</dt>
    <dd><span>Phrasing content</span>.</dd>
    <dd><span>Interactive content</span>.</dd>
+   <dd><span>Form-associated element</span>.</dd>
    <dt>Contexts in which this element may be used:</dt>
    <dd>Where <span>phrasing content</span> is expected.</dd>
    <dt>Content model:</dt>
@@ -24296,7 +24302,7 @@
    <dd><code title="attr-textarea-autofocus">autofocus</code></dd>
    <dd><code title="attr-textarea-cols">cols</code></dd>
    <dd><code title="attr-textarea-disabled">disabled</code></dd>
-   <dd><code title="attr-textarea-form">form</code></dd>
+   <dd><code title="attr-fae-form">form</code></dd>
    <dd><code title="attr-textarea-inputmode">inputmode</code></dd>
    <dd><code title="attr-textarea-maxlength">maxlength</code></dd>
    <dd><code title="attr-textarea-name">name</code></dd>
@@ -24312,7 +24318,7 @@
            attribute boolean <span title="dom-textarea-autofocus">autofocus</span>;
            attribute unsigned long <span title="dom-textarea-cols">cols</span>;
            attribute boolean <span title="dom-textarea-disabled">disabled</span>;
-  readonly attribute <span>HTMLFormElement</span> <span title="dom-textarea-form">form</span>;
+  readonly attribute <span>HTMLFormElement</span> <span title="dom-fae-form">form</span>;
            attribute DOMString <span title="dom-textarea-inputmode">inputmode</span>;
            attribute long <span title="dom-textarea-maxLength">maxLength</span>;
            attribute DOMString <span title="dom-textarea-name">name</span>;
@@ -24350,19 +24356,20 @@
   <dl class="element">
    <dt>Categories</dt>
    <dd><span>Phrasing content</span>.</dd>
+   <dd><span>Form-associated element</span>.</dd>
    <dt>Contexts in which this element may be used:</dt>
    <dd>Where <span>phrasing content</span> is expected.</dd>
    <dt>Content model:</dt>
    <dd><span>Phrasing content</span>.</dd>
    <dt>Element-specific attributes:</dt>
    <dd><code title="attr-output-for">for</code></dd>
-   <dd><code title="attr-output-form">form</code></dd>
+   <dd><code title="attr-fae-form">form</code></dd>
    <dd><code title="attr-output-name">name</code></dd>
    <dt>DOM interface:</dt>
    <dd>
 <pre class="idl">interface <dfn>HTMLOutputElement</dfn> : <span>HTMLElement</span> {
            attribute DOMString <span title="dom-output-wrap">htmlFor</span>;
-  readonly attribute <span>HTMLFormElement</span> <span title="dom-output-form">form</span>;
+  readonly attribute <span>HTMLFormElement</span> <span title="dom-fae-form">form</span>;
            attribute DOMString <span title="dom-output-name">name</span>;
 
   readonly attribute DOMString <span title="dom-output-type">type</span>;
@@ -24383,11 +24390,99 @@
 
   <h4>Association of controls and forms</h4>
 
-  <p class="big-issue">When an element is <dfn
-  title="concept-form-association">associated with a form</dfn>,
-  ...</p>
+  <!-- XXX consider xreffing the 'ID' term in this section -->
 
+  <p>A <dfn>form-associated element</dfn> is one that can have a
+  relationship with a <code>form</code> element, which is called the
+  element's <dfn>form owner</dfn>.</p>
 
+  <p>A <span>form-associated element</span> is, by default, associated
+  with its nearest ancestor <code>form</code> element (as described
+  below), but may have a <dfn
+  title="attr-fae-form"><code>form</code></dfn> attribute specified to
+  override this.</p>
+
+  <p>If a <span>form-associated element</span> has a <code
+  title="attr-fae-form">form</code> attribute specified, then its
+  value must be the ID of a <code>form</code> element in the element's
+  owner <code>Document</code>.</p>
+
+  <p>When a <span>form-associated element</span> is created, its
+  <span>form owner</span> must be initialized to null (no owner).</p>
+
+  <p>When a <span>form-associated element</span> is to be <dfn
+  title="concept-form-association">associated</dfn> with a form, its
+  <span>form owner</span> must be set to that form.</p>
+
+  <p>When a <span>form-associated element</span>'s ancestor chain
+  changes, e.g. because it or one of its ancestors was inserted or
+  removed from a <code>Document</code>, then the user agent must
+  <span>reset the form owner</span> of that element.</p>
+
+  <p>When a <span>form-associated element</span>'s <code
+  title="attr-fae-form">form</code> attribute is added, removed, or
+  has its value changed, then the user agent must <span>reset the form
+  owner</span> of that element.</p>
+
+  <p>When a <span>form-associated element</span> has a <code
+  title="attr-fae-form">form</code> attribute and the ID of any of the
+  <code>form</code> elements in the <code>Document</code> changes,
+  then the user agent must <span>reset the form owner</span> of that
+  <span>form-associated element</span>.</p>
+
+  <p>When the user agent is to <dfn>reset the form owner</dfn> of a
+  <span>form-associated element</span>, it must run the following
+  steps:</p>
+
+  <ol>
+
+   <li><p>If the element's <span>form owner</span> is not null, and
+   the element's <code title="attr-fae-form">form</code> content
+   attribute is not present, and the element's <span>form owner</span>
+   is one of the ancestors of the element after the change to the
+   ancestor chain, then do nothing, and abort these steps.</p></li>
+
+   <li><p>Let the element's <span>form owner</span> be null.</p></li>
+
+   <li>
+
+    <p>If the element has a <code title="attr-fae-form">form</code>
+    content attribute, then run these substeps:</p>
+
+    <ol>
+
+     <!-- XXX how does ID matching get affected by quirks mode? -->
+     <li><p>If the first element in the <code>Document</code> to have
+     an ID that is equal to the element's <code
+     title="attr-fae-form">form</code> content attribute's value is a
+     <code>form</code> element, then <span
+     title="concept-form-association">associate</span> the
+     <span>form-associated element</span> with that <code>form</code>
+     element.</p></li>
+
+     <li><p>Abort the "reset the form owner" steps.</p></li>
+
+    </ol>
+
+   </li>
+
+   <li><p>Otherwise, if the <span>form-associated element</span> in
+   question has an ancestor <code>form</code> element, then <span
+   title="concept-form-association">associate</span> the
+   <span>form-associated element</span> with the nearest such ancestor
+   <code>form</code> element.</p></li>
+
+   <li><p>Otherwise, the element is left unassociated.</p></li>
+
+  </ol>
+
+  <p><span title="form-associated element">Form-associated
+  elements</span> have a <dfn
+  title="dom-foa-form"><code>form</code></dfn> DOM attribute, which,
+  on getting, must return the element's <span>form owner</span>, or
+  null if there isn't one.</p>
+
+
   <h4>Processing model</h4>
 
   <p class="big-issue">See <a href="http://www.whatwg.org/specs/web-forms/current-work/#extend-form-controls">WF2</a> for now</p>
@@ -34376,7 +34471,7 @@
   title="dom-PopStateEvent-initPopStateEvent"><code>initPopStateEvent()</code></dfn>
   and <dfn
   title="dom-PopStateEvent-initPopStateEventNS"><code>initPopStateEventNS()</code></dfn>
-  methods must initialise the event in a manner analogous to the
+  methods must initialize the event in a manner analogous to the
   similarly-named methods in the DOM3 Events interfaces. <a
   href="#refsDOM3EVENTS">[DOM3EVENTS]</a></p>
 
@@ -35774,7 +35869,7 @@
   title="dom-StorageEvent-initStorageEvent"><code>initStorageEvent()</code></dfn>
   and <dfn
   title="dom-StorageEvent-initStorageEventNS"><code>initStorageEventNS()</code></dfn>
-  methods must initialise the event in a manner analogous to the
+  methods must initialize the event in a manner analogous to the
   similarly-named methods in the DOM3 Events interfaces. <a
   href="#refsDOM3EVENTS">[DOM3EVENTS]</a></p>
 
@@ -39170,7 +39265,7 @@
   title="dom-DragEvent-initDragEvent"><code>initDragEvent()</code></dfn>
   and <dfn
   title="dom-DragEvent-initDragEventNS"><code>initDragEventNS()</code></dfn>
-  methods must initialise the event in a manner analogous to the
+  methods must initialize the event in a manner analogous to the
   similarly-named methods in the DOM3 Events interfaces. <a
   href="#refsDOM3EVENTS">[DOM3EVENTS]</a></p>
 
@@ -39226,7 +39321,7 @@
   <p>The <dfn
   title="dom-DataTransfer-effectAllowed"><code>effectAllowed</code></dfn>
   attribute is used in the drag-and-drop processing model to
-  initialise the <code
+  initialize the <code
   title="dom-DataTransfer-dropEffect">dropEffect</code> attribute
   during the <code title="event-dragenter">dragenter</code> and <code
   title="event-dragover">dragover</code> events.</p>
@@ -40406,7 +40501,7 @@
   title="dom-UndoManagerEvent-initUndoManagerEvent"><code>initUndoManagerEvent()</code></dfn>
   and <dfn><code
   title="dom-UndoManagerEvent-initUndoManagerEventNS">initUndoManagerEventNS()</code></dfn>
-  methods must initialise the event in a manner analogous to the
+  methods must initialize the event in a manner analogous to the
   similarly-named methods in the DOM3 Events interfaces. <a
   href="#refsDOM3EVENTS">[DOM3EVENTS]</a></p>
 
@@ -40882,7 +40977,7 @@
   title="dom-MessageEvent-initMessageEvent"><code>initMessageEvent()</code></dfn>
   and <dfn
   title="dom-MessageEvent-initMessageEventNS"><code>initMessageEventNS()</code></dfn>
-  methods must initialise the event in a manner analogous to the
+  methods must initialize the event in a manner analogous to the
   similarly-named methods in the DOM3 Events interfaces. <a
   href="#refsDOM3EVENTS">[DOM3EVENTS]</a></p>
 
@@ -45071,7 +45166,7 @@
 
   <ol>
 
-   <li><p>Initialise <var title="">node</var> to be the <span>current
+   <li><p>Initialize <var title="">node</var> to be the <span>current
    node</span> (the bottommost node of the stack).</p></li>
 
    <li><p>If <var title="">node</var> is the target node, terminate in
@@ -45108,7 +45203,7 @@
 
   <ol>
 
-   <li><p>Initialise <var title="">node</var> to be the <span>current
+   <li><p>Initialize <var title="">node</var> to be the <span>current
    node</span> (the bottommost node of the stack).</p></li>
 
    <li><p>If <var title="">node</var> is the target node, terminate in
@@ -47926,7 +48021,8 @@
     <p><span>Insert an HTML element</span> for the token.</p>
 
     <p>If the <span><code title="">form</code> element pointer</span>
-    is not null, then <span
+    is not null and the newly created element doesn't have a <code
+    title="attr-fae-form">form</code> attribute, then <span
     title="concept-form-association">associate</span> the newly
     created <code>fieldset</code> element with the <code>form</code>
     element pointed to by the <span><code title="">form</code> element
@@ -47942,7 +48038,7 @@
 
     <ol>
 
-     <li><p>Initialise <var title="">node</var> to be the <span>current
+     <li><p>Initialize <var title="">node</var> to be the <span>current
      node</span> (the bottommost node of the stack).</p></li>
 
      <li><p>If <var title="">node</var> is an <code>li</code> element,
@@ -47990,7 +48086,7 @@
 
     <ol>
 
-     <li><p>Initialise <var title="">node</var> to be the <span>current
+     <li><p>Initialize <var title="">node</var> to be the <span>current
      node</span> (the bottommost node of the stack).</p></li>
 
      <li><p>If <var title="">node</var> is a <code>dd</code> or
@@ -48474,7 +48570,8 @@
     <p><span>Insert an HTML element</span> for the token.</p>
 
     <p>If the <span><code title="">form</code> element pointer</span>
-    is not null, then <span
+    is not null and the newly created element doesn't have a <code
+    title="attr-fae-form">form</code> attribute, then <span
     title="concept-form-association">associate</span> the
     <code>button</code> element with the <code>form</code> element
     pointed to by the <span><code title="">form</code> element
@@ -48621,7 +48718,8 @@
     token's <i>self-closing flag</i></span>, if it is set.</p>
 
     <p>If the <span><code title="">form</code> element pointer</span>
-    is not null, then <span
+    is not null and the newly created element doesn't have a <code
+    title="attr-fae-form">form</code> attribute, then <span
     title="concept-form-association">associate</span> the newly
     created <code>input</code> element with the <code>form</code>
     element pointed to by the <span><code title="">form</code> element
@@ -48638,7 +48736,8 @@
     <p><span>Insert an HTML element</span> for the token.</p>
 
     <p>If the <span><code title="">form</code> element pointer</span>
-    is not null, then <span
+    is not null and the newly created element doesn't have a <code
+    title="attr-fae-form">form</code> attribute, then <span
     title="concept-form-association">associate</span> the newly
     created <code>label</code> element with the <code>form</code>
     element pointed to by the <span><code title="">form</code> element
@@ -48735,7 +48834,8 @@
     node</span>.</p>
 
     <p>If the <span><code title="">form</code> element pointer</span>
-    is not null, then <span
+    is not null and the newly created element doesn't have a <code
+    title="attr-fae-form">form</code> attribute, then <span
     title="concept-form-association">associate</span> the newly
     created <code>textarea</code> element with the <code>form</code>
     element pointed to by the <span><code title="">form</code> element
@@ -48782,7 +48882,8 @@
     <p><span>Insert an HTML element</span> for the token.</p>
 
     <p>If the <span><code title="">form</code> element pointer</span>
-    is not null, then <span
+    is not null and the newly created element doesn't have a <code
+    title="attr-fae-form">form</code> attribute, then <span
     title="concept-form-association">associate</span> the
     <code>select</code> element with the <code>form</code> element
     pointed to by the <span><code title="">form</code> element
@@ -48954,7 +49055,7 @@
 
     <ol>
 
-     <li><p>Initialise <var title="">node</var> to be the <span>current
+     <li><p>Initialize <var title="">node</var> to be the <span>current
      node</span> (the bottommost node of the stack).</p></li>
 
      <li><p>If <var title="">node</var> has the same tag name as
@@ -50684,7 +50785,7 @@
 
   <ol>
 
-   <li><p>Let <var title="">s</var> be a string, and initialise it to
+   <li><p>Let <var title="">s</var> be a string, and initialize it to
    the empty string.</p></li>
 
    <li>

|