HTML Standard Tracker

Diff (omit for latest revision)
Filter

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

File a bug

SVNBugCommentTime (UTC)
2191WF2: <label>.2008-09-16 08:05
Index: source
===================================================================
--- source	(revision 2190)
+++ source	(revision 2191)
@@ -23940,6 +23940,11 @@
    and <code title="dom-fieldset-elements"><var
    title="">fieldset</var>.elements</code> APIs.</dd>
 
+   <dt><dfn title="category-label">Labelable</dfn></dt>
+
+   <dd>Denotes elements that can be associated with <code>label</code>
+   elements.</dd>
+
   </dl>
 
   <p>In addition, some <span
@@ -24172,7 +24177,8 @@
    <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>
+   <dd>If the element has a <code title="attr-label-for">for</code> attribute: <span>Phrasing content</span>, but with no descendant <span title="category-label">labelable form-associated elements</span> or <code>label</code> elements.</dd>
+   <dd>Otherwise: <span>Phrasing content</span>, but with at most one descendant <span title="category-label">labelable form-associated element</span>, and with no descendant <code>label</code> elements.</dd>
    <dt>Element-specific attributes:</dt>
    <dd><code title="attr-fae-form">form</code></dd>
    <dd><code title="attr-label-for">for</code></dd>
@@ -24186,26 +24192,67 @@
    </dd> 
   </dl>
 
-  <p class="big-issue">...</p>
-<!--XXX
-what does <label> _mean_? how about an empty one, one which contains
-more than one control, no controls?
--->
+  <p>The <code>label</code> represents a caption in a user
+  interface. The caption can be associated with a specific form
+  control, known as the <code>label</code> element's <dfn>labeled
+  control</dfn>.</p>
 
+  <p>Unless otherwise specified by the following rules, a
+  <code>label</code> element has no <span>labeled control</span>.</p>
+
+  <p>The <dfn title="attr-label-for"><code>for</code></dfn> attribute
+  may be specified to indicate a form control with which the caption
+  is to be associated. If the attribute is specified, the attribute's
+  value must be the ID of a <span title="category-label">labelable
+  form-associated element</span> in the same <code>Document</code> as
+  the <code>label</code> element. If the attribute is specified and
+  there is an element in the <code>Document</code> whose ID is equal
+  to the value of the <code title="attr-label-for">for</code>
+  attribute, and the first such element is a <span
+  title="category-label">labelable form-associated element</span>,
+  then that element is the <code>label</code> element's <span>labeled
+  control</span>.</p>
+
+  <p>If the <code title="attr-label-for">for</code> attribute is not
+  specified, but the <code>label</code> element has a <span>labelable
+  form-associated element</span> descendant, then the first such
+  descendant in <span>tree order</span> is the <code>label</code>
+  element's <span>labeled control</span>.</p>
+
   <p>The <code title="attr-fae-form">form</code> attribute is used to
   explicitly associate the <code>label</code> element with its
   <span>form owner</span>. The <code title="attr-fe-name">name</code>
   attribute represents the element's name.</p>
 
+  <p>The <dfn title="dom-label-htmlFor"><code>htmlFor</code></dfn> DOM
+  attribute must <span>reflect</span> the <code
+  title="attr-label-for">for</code> content attribute.</p>
 
+  <p>The <dfn title="dom-label-control"><code>control</code></dfn> DOM
+  attribute must return the <code>label</code> element's <span>labeled
+  control</span>, if any, or null if there isn't one.</p>
 
+  <hr>
+
+  <p><span title="labelable form-associated element">Labelable
+  form-associated elements</span> have a <code>NodeList</code> object
+  associated with them that represents the list of <code>label</code>
+  elements, in <span>tree order</span>, whose <span>labeled
+  control</span> is the element in question. The <dfn
+  title="dom-lfe-labels"><code>labels</code></dfn> DOM attribute of
+  <span title="labelable form-associated element">labelable
+  form-associated elements</span>, on getting, must return that
+  <code>NodeList</code> object.</p>
+
+
+
   <h4>The <dfn><code>input</code></dfn> element</h4>
 
   <dl class="element">
    <dt>Categories</dt>
    <dd><span>Phrasing content</span>.</dd>
    <dd><span>Interactive content</span>.</dd>
-   <dd><span title="category-listed">Listed</span>, <span title="category-submit">submittable</span>, and <span title="category-reset">resettable</span> <span>form-associated element</span>.</dd>
+   <dd><span title="category-listed">Listed</span>, <span title="category-label">labelable</span>, <span title="category-submit">submittable</span>, and <span title="category-reset">resettable</span> <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>
@@ -24270,7 +24317,7 @@
            attribute float <span title="dom-input-valueAsNumber">valueAsNumber</span>;
   readonly attribute <span>HTMLOptionElement</span> <span title="dom-input-selectedOption">selectedOption</span>;
 
-  readonly attribute <span>HTMLCollection</span> <span title="dom-input-labels">labels</span>;
+  readonly attribute <span>HTMLCollection</span> <span title="dom-lfe-labels">labels</span>;
 
   void <span title="dom-input-stepUp">stepUp</span>(in int n);
   void <span title="dom-input-stepDown">stepDown</span>(in int n);
@@ -24320,7 +24367,7 @@
    <dt>Categories</dt>
    <dd><span>Phrasing content</span>.</dd>
    <dd><span>Interactive content</span>.</dd>
-   <dd><span title="category-listed">Listed</span> and <span title="category-submit">submittable</span> <span>form-associated element</span>.</dd>
+   <dd><span title="category-listed">Listed</span>, <span title="category-label">labelable</span>, and <span title="category-submit">submittable</span> <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>
@@ -24350,7 +24397,7 @@
            attribute DOMString <span title="dom-button-type">type</span>;
            attribute DOMString <span title="dom-button-value">value</span>;
 
-  readonly attribute <span>HTMLCollection</span> <span title="dom-button-labels">labels</span>;
+  readonly attribute <span>HTMLCollection</span> <span title="dom-lfe-labels">labels</span>;
 
   readonly attribute boolean <span title="dom-cva-willValidate">willValidate</span>;
   readonly attribute <span>ValidityState</span> <span title="dom-cva-validity">validity</span>;
@@ -24385,7 +24432,7 @@
    <dt>Categories</dt>
    <dd><span>Phrasing content</span>.</dd>
    <dd><span>Interactive content</span>.</dd>
-   <dd><span title="category-listed">Listed</span>, <span title="category-submit">submittable</span>, and <span title="category-reset">resettable</span> <span>form-associated element</span>.</dd>
+   <dd><span title="category-listed">Listed</span>, <span title="category-label">labelable</span>, <span title="category-submit">submittable</span>, and <span title="category-reset">resettable</span> <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>
@@ -24417,7 +24464,7 @@
            attribute long <span title="dom-select-selectedIndex">selectedIndex</span>;
            attribute DOMString <span title="dom-select-value">value</span>;
 
-  readonly attribute <span>HTMLCollection</span> <span title="dom-select-labels">labels</span>;
+  readonly attribute <span>HTMLCollection</span> <span title="dom-lfe-labels">labels</span>;
 
   void <span title="dom-select-add">add</span>(in <span>HTMLElement</span> element, in <span>HTMLElement</span> before);
   void <span title="dom-select-remove">remove</span>(in long index);
@@ -24552,7 +24599,7 @@
    <dt>Categories</dt>
    <dd><span>Phrasing content</span>.</dd>
    <dd><span>Interactive content</span>.</dd>
-   <dd><span title="category-listed">Listed</span>, <span title="category-submit">submittable</span>, and <span title="category-reset">resettable</span> <span>form-associated element</span>.</dd>
+   <dd><span title="category-listed">Listed</span>, <span title="category-label">labelable</span>, <span title="category-submit">submittable</span>, and <span title="category-reset">resettable</span> <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>
@@ -24592,7 +24639,7 @@
            attribute DOMString <span title="dom-textarea-defaultValue">defaultValue</span>;
            attribute DOMString <span title="dom-textarea-value">value</span>;
 
-  readonly attribute <span>HTMLCollection</span> <span title="dom-textarea-labels">labels</span>;
+  readonly attribute <span>HTMLCollection</span> <span title="dom-lfe-labels">labels</span>;
 
   readonly attribute boolean <span title="dom-cva-willValidate">willValidate</span>;
   readonly attribute <span>ValidityState</span> <span title="dom-cva-validity">validity</span>;

|