Permalink
Browse files

[] (0) WF2: <label>.

git-svn-id: http://svn.whatwg.org/webapps@2191 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
1 parent b1b99a3 commit 3addcd6ac81077c7a690aa11538b9b6d30fd2d74 @Hixie Hixie committed Sep 16, 2008
Showing with 140 additions and 28 deletions.
  1. +79 −14 index
  2. +61 −14 source
View
93 index
@@ -26582,6 +26582,11 @@ function AddCloud(data, x, y) { ... }</pre>
title="">form</var>.elements</a></code> and <code
title=dom-fieldset-elements><a href="#elements4"><var
title="">fieldset</var>.elements</a></code> APIs.
+
+ <dt><dfn id=labelable title=category-label>Labelable</dfn>
+
+ <dd>Denotes elements that can be associated with <code><a
+ href="#label">label</a></code> elements.
</dl>
<p>In addition, some <a href="#submittable"
@@ -26858,37 +26863,93 @@ function AddCloud(data, x, y) { ... }</pre>
<dt>Content model:
- <dd><a href="#phrasing0">Phrasing content</a>.
+ <dd>If the element has a <code title=attr-label-for><a
+ href="#for">for</a></code> attribute: <a href="#phrasing0">Phrasing
+ content</a>, but with no descendant <a href="#labelable"
+ title=category-label>labelable form-associated elements</a> or <code><a
+ href="#label">label</a></code> elements.
+
+ <dd>Otherwise: <a href="#phrasing0">Phrasing content</a>, but with at most
+ one descendant <a href="#labelable" title=category-label>labelable
+ form-associated element</a>, and with no descendant <code><a
+ href="#label">label</a></code> elements.
<dt>Element-specific attributes:
<dd><code title=attr-fae-form><a href="#form0">form</a></code>
- <dd><code title=attr-label-for>for</code>
+ <dd><code title=attr-label-for><a href="#for">for</a></code>
<dt>DOM interface:
<dd>
<pre
class=idl>interface <dfn id=htmllabelelement>HTMLLabelElement</dfn> : <a href="#htmlelement">HTMLElement</a> {
readonly attribute <a href="#htmlformelement">HTMLFormElement</a> <a href="#form1" title=dom-fae-form>form</a>;
- attribute DOMString <span title=dom-label-htmlFor>htmlFor</span>;
- readonly attribute <a href="#htmlelement">HTMLElement</a> <span title=dom-label-control>control</span>;
+ attribute DOMString <a href="#htmlfor" title=dom-label-htmlFor>htmlFor</a>;
+ readonly attribute <a href="#htmlelement">HTMLElement</a> <a href="#control" title=dom-label-control>control</a>;
};</pre>
</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><a href="#label">label</a></code> represents a caption in a
+ user interface. The caption can be associated with a specific form
+ control, known as the <code><a href="#label">label</a></code> element's
+ <dfn id=labeled>labeled control</dfn>.
+
+ <p>Unless otherwise specified by the following rules, a <code><a
+ href="#label">label</a></code> element has no <a href="#labeled">labeled
+ control</a>.
+
+ <p>The <dfn id=for 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 <a href="#labelable" title=category-label>labelable
+ form-associated element</a> in the same <code>Document</code> as the
+ <code><a href="#label">label</a></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><a
+ href="#for">for</a></code> attribute, and the first such element is a <a
+ href="#labelable" title=category-label>labelable form-associated
+ element</a>, then that element is the <code><a
+ href="#label">label</a></code> element's <a href="#labeled">labeled
+ control</a>.
+
+ <p>If the <code title=attr-label-for><a href="#for">for</a></code>
+ attribute is not specified, but the <code><a
+ href="#label">label</a></code> element has a <span>labelable
+ form-associated element</span> descendant, then the first such descendant
+ in <a href="#tree-order">tree order</a> is the <code><a
+ href="#label">label</a></code> element's <a href="#labeled">labeled
+ control</a>.
<p>The <code title=attr-fae-form><a href="#form0">form</a></code> attribute
is used to explicitly associate the <code><a
href="#label">label</a></code> element with its <a href="#form-owner">form
owner</a>. The <code title=attr-fe-name><a href="#name11">name</a></code>
attribute represents the element's name.
+ <p>The <dfn id=htmlfor title=dom-label-htmlFor><code>htmlFor</code></dfn>
+ DOM attribute must <a href="#reflect">reflect</a> the <code
+ title=attr-label-for><a href="#for">for</a></code> content attribute.
+
+ <p>The <dfn id=control title=dom-label-control><code>control</code></dfn>
+ DOM attribute must return the <code><a href="#label">label</a></code>
+ element's <a href="#labeled">labeled control</a>, if any, or null if there
+ isn't one.
+
+ <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><a
+ href="#label">label</a></code> elements, in <a href="#tree-order">tree
+ order</a>, whose <a href="#labeled">labeled control</a> is the element in
+ question. The <dfn id=labels
+ 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.
+
<h4 id=the-input><span class=secno>4.9.4 </span>The <dfn
id=input0><code>input</code></dfn> element</h4>
@@ -26900,6 +26961,7 @@ more than one control, no controls?
<dd><a href="#interactive1">Interactive content</a>.
<dd><a href="#listed" title=category-listed>Listed</a>, <a
+ href="#labelable" title=category-label>labelable</a>, <a
href="#submittable" title=category-submit>submittable</a>, and <a
href="#resettable" title=category-reset>resettable</a> <a
href="#form-associated">form-associated element</a>.
@@ -27000,7 +27062,7 @@ more than one control, no controls?
attribute float <span title=dom-input-valueAsNumber>valueAsNumber</span>;
readonly attribute <a href="#htmloptionelement">HTMLOptionElement</a> <span title=dom-input-selectedOption>selectedOption</span>;
- readonly attribute <a href="#htmlcollection0">HTMLCollection</a> <span title=dom-input-labels>labels</span>;
+ readonly attribute <a href="#htmlcollection0">HTMLCollection</a> <a href="#labels" title=dom-lfe-labels>labels</a>;
void <span title=dom-input-stepUp>stepUp</span>(in int n);
void <span title=dom-input-stepDown>stepDown</span>(in int n);
@@ -27055,7 +27117,8 @@ rel="" on submit buttons?
<dd><a href="#interactive1">Interactive content</a>.
- <dd><a href="#listed" title=category-listed>Listed</a> and <a
+ <dd><a href="#listed" title=category-listed>Listed</a>, <a
+ href="#labelable" title=category-label>labelable</a>, and <a
href="#submittable" title=category-submit>submittable</a> <a
href="#form-associated">form-associated element</a>.
@@ -27105,7 +27168,7 @@ rel="" on submit buttons?
attribute DOMString <span title=dom-button-type>type</span>;
attribute DOMString <span title=dom-button-value>value</span>;
- readonly attribute <a href="#htmlcollection0">HTMLCollection</a> <span title=dom-button-labels>labels</span>;
+ readonly attribute <a href="#htmlcollection0">HTMLCollection</a> <a href="#labels" title=dom-lfe-labels>labels</a>;
readonly attribute boolean <a href="#willvalidate" title=dom-cva-willValidate>willValidate</a>;
readonly attribute <span>ValidityState</span> <a href="#validity" title=dom-cva-validity>validity</a>;
@@ -27145,6 +27208,7 @@ rel="" on submit buttons?
<dd><a href="#interactive1">Interactive content</a>.
<dd><a href="#listed" title=category-listed>Listed</a>, <a
+ href="#labelable" title=category-label>labelable</a>, <a
href="#submittable" title=category-submit>submittable</a>, and <a
href="#resettable" title=category-reset>resettable</a> <a
href="#form-associated">form-associated element</a>.
@@ -27194,7 +27258,7 @@ rel="" on submit buttons?
attribute long <span title=dom-select-selectedIndex>selectedIndex</span>;
attribute DOMString <span title=dom-select-value>value</span>;
- readonly attribute <a href="#htmlcollection0">HTMLCollection</a> <span title=dom-select-labels>labels</span>;
+ readonly attribute <a href="#htmlcollection0">HTMLCollection</a> <a href="#labels" title=dom-lfe-labels>labels</a>;
void <span title=dom-select-add>add</span>(in <a href="#htmlelement">HTMLElement</a> element, in <a href="#htmlelement">HTMLElement</a> before);
void <span title=dom-select-remove>remove</span>(in long index);
@@ -27371,6 +27435,7 @@ interface <dfn id=htmloptionelement>HTMLOptionElement</dfn> : <a href="#htmlelem
<dd><a href="#interactive1">Interactive content</a>.
<dd><a href="#listed" title=category-listed>Listed</a>, <a
+ href="#labelable" title=category-label>labelable</a>, <a
href="#submittable" title=category-submit>submittable</a>, and <a
href="#resettable" title=category-reset>resettable</a> <a
href="#form-associated">form-associated element</a>.
@@ -27434,7 +27499,7 @@ interface <dfn id=htmloptionelement>HTMLOptionElement</dfn> : <a href="#htmlelem
attribute DOMString <span title=dom-textarea-defaultValue>defaultValue</span>;
attribute DOMString <span title=dom-textarea-value>value</span>;
- readonly attribute <a href="#htmlcollection0">HTMLCollection</a> <span title=dom-textarea-labels>labels</span>;
+ readonly attribute <a href="#htmlcollection0">HTMLCollection</a> <a href="#labels" title=dom-lfe-labels>labels</a>;
readonly attribute boolean <a href="#willvalidate" title=dom-cva-willValidate>willValidate</a>;
readonly attribute <span>ValidityState</span> <a href="#validity" title=dom-cva-validity>validity</a>;
View
75 source
@@ -23940,6 +23940,11 @@ function AddCloud(data, x, y) { ... }</pre>
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 @@ function AddCloud(data, x, y) { ... }</pre>
<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,17 +24192,58 @@ function AddCloud(data, x, y) { ... }</pre>
</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>
@@ -24205,7 +24252,7 @@ more than one control, no controls?
<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 @@ more than one control, no controls?
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 @@ rel="" on submit buttons?
<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 @@ rel="" on submit buttons?
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 @@ rel="" on submit buttons?
<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 @@ rel="" on submit buttons?
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 @@ interface <dfn>HTMLOptionElement</dfn> : <span>HTMLElement</span> {
<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 @@ interface <dfn>HTMLOptionElement</dfn> : <span>HTMLElement</span> {
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>;

0 comments on commit 3addcd6

Please sign in to comment.