Skip to content

Commit

Permalink
[giow] (3) Try to clean up <option> element selectedness handling.
Browse files Browse the repository at this point in the history
Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=18946
Affected topics: DOM APIs, HTML

git-svn-id: http://svn.whatwg.org/webapps@7559 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Dec 2, 2012
1 parent 54bd38b commit 00c9d0c
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 37 deletions.
35 changes: 23 additions & 12 deletions complete.html
Expand Up @@ -248,7 +248,7 @@

<header class=head id=head><p><a class=logo href=http://www.whatwg.org/><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
<hgroup><h1 class=allcaps>HTML</h1>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 1 December 2012</h2>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 2 December 2012</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>
Expand Down Expand Up @@ -51836,7 +51836,7 @@ <h4 id=the-select-element><span class=secno>4.10.9 </span>The <dfn><code>select<
<code><a href=#the-option-element>option</a></code> element in the <code><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> has its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true, and whenever an
<code><a href=#the-option-element>option</a></code> element with its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a>
set to true is added to the <code><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>, the user agent must set the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of all the other <code><a href=#the-option-element>option</a></code>
element in its <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> to false.</p>
elements in its <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> to false.</p>

<p>If the <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is absent and the element's
<a href=#concept-select-size title=concept-select-size>display size</a> is greater than 1, then the user agent
Expand All @@ -51849,13 +51849,15 @@ <h4 id=the-select-element><span class=secno>4.10.9 </span>The <dfn><code>select<
<code><a href=#the-select-element>select</a></code> element, using the <a href=#user-interaction-task-source>user interaction task source</a> as the task
source.</p>

<p>If the <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is absent and the element's
<a href=#concept-select-size title=concept-select-size>display size</a> is 1, then whenever there are no
<code><a href=#the-option-element>option</a></code> elements in the <code><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> that have their <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true, the user agent must set the
<a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of the first <code><a href=#the-option-element>option</a></code>
element in the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> in <a href=#tree-order>tree
order</a> that is not <a href=#concept-option-disabled title=concept-option-disabled>disabled</a>, if any, to
true.</p>
<p>If <a href=#nodes-are-inserted>nodes are inserted</a> or <a href=#nodes-are-removed>nodes are removed</a> causing the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> to gain or lose one or more
<code><a href=#the-option-element>option</a></code> elements, or if an <code><a href=#the-option-element>option</a></code> element in the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> <dfn id=ask-for-a-reset title="ask for a reset">asks for a
reset</dfn>, then, if the <code><a href=#the-select-element>select</a></code> element's <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is absent, the <code><a href=#the-select-element>select</a></code>
element's <a href=#concept-select-size title=concept-select-size>display size</a> is 1, and no <code><a href=#the-option-element>option</a></code>
elements in the <code><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list title=concept-select-option-list>list of
options</a> have their <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to
true, the user agent must set the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of
the first <code><a href=#the-option-element>option</a></code> element in the <a href=#concept-select-option-list title=concept-select-option-list>list of
options</a> in <a href=#tree-order>tree order</a> that is not <a href=#concept-option-disabled title=concept-option-disabled>disabled</a>, if any, to true.</p>

<p>If the <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is present, and the element
is not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>, then the user agent should allow the
Expand All @@ -51868,8 +51870,9 @@ <h4 id=the-select-element><span class=secno>4.10.9 </span>The <dfn><code>select<
source.</p>

<p>The <a href=#concept-form-reset-control title=concept-form-reset-control>reset algorithm</a> for <code><a href=#the-select-element>select</a></code>
elements is to go through all the <code><a href=#the-option-element>option</a></code> elements in the element's <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>, and set their <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> to true if the <code><a href=#the-option-element>option</a></code> element
has a <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute, and false otherwise.</p>
elements is to go through all the <code><a href=#the-option-element>option</a></code> elements in the element's <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>, set their <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> to true if the <code><a href=#the-option-element>option</a></code> element
has a <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute, and false otherwise, and then
have the <code><a href=#the-option-element>option</a></code> elements <a href=#ask-for-a-reset>ask for a reset</a>.</p>

</div>

Expand Down Expand Up @@ -52030,6 +52033,10 @@ <h4 id=the-select-element><span class=secno>4.10.9 </span>The <dfn><code>select<
options</a> whose <a href=#concept-option-index title=concept-option-index>index</a> is the given new value, if
any, must have its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true.</p>

<p class=note>This can result in no element having a <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true even in the case of the
<code><a href=#the-select-element>select</a></code> element having no <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute
and a <a href=#concept-select-size title=concept-select-size>display size</a> of 1.</p>

<p>The <dfn id=dom-select-value title=dom-select-value><code>value</code></dfn> IDL attribute, on getting, must
return the <a href=#concept-option-value title=concept-option-value>value</a> of the first <code><a href=#the-option-element>option</a></code>
element in the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> in <a href=#tree-order>tree
Expand All @@ -52042,6 +52049,10 @@ <h4 id=the-select-element><span class=secno>4.10.9 </span>The <dfn><code>select<
options</a>, in <a href=#tree-order>tree order</a>, whose <a href=#concept-option-value title=concept-option-value>value</a>
is equal to the given new value, if any, must have its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true.</p>

<p class=note>This can result in no element having a <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true even in the case of the
<code><a href=#the-select-element>select</a></code> element having no <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute
and a <a href=#concept-select-size title=concept-select-size>display size</a> of 1.</p>

<p>The <dfn id=dom-select-multiple title=dom-select-multiple><code>multiple</code></dfn>, <dfn id=dom-select-required title=dom-select-required><code>required</code></dfn>, and <dfn id=dom-select-size title=dom-select-size><code>size</code></dfn> IDL attributes must <a href=#reflect>reflect</a> the
respective content attributes of the same name. The <code title=dom-select-size><a href=#dom-select-size>size</a></code> IDL
attribute has a default value of zero.</p> <!-- see bug 12288 for compat reasons why .size allows
Expand Down Expand Up @@ -52458,7 +52469,7 @@ <h4 id=the-option-element><span class=secno>4.10.12 </span>The <dfn><code>option
<p>The <dfn id=dom-option-selected title=dom-option-selected><code>selected</code></dfn>
IDL attribute, on getting, must return true if the element's <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> is true, and
false otherwise. On setting, it must set the element's <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> to the new
value.</p>
value, and then cause the element to <a href=#ask-for-a-reset>ask for a reset</a>.</p>

<p>The <dfn id=dom-option-index title=dom-option-index><code>index</code></dfn> IDL
attribute must return the element's <a href=#concept-option-index title=concept-option-index>index</a>.</p>
Expand Down
35 changes: 23 additions & 12 deletions index
Expand Up @@ -248,7 +248,7 @@

<header class=head id=head><p><a class=logo href=http://www.whatwg.org/><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
<hgroup><h1 class=allcaps>HTML</h1>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 1 December 2012</h2>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 2 December 2012</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>
Expand Down Expand Up @@ -51836,7 +51836,7 @@ You cannot submit this form when the field is incorrect.</samp></pre>
<code><a href=#the-option-element>option</a></code> element in the <code><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> has its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true, and whenever an
<code><a href=#the-option-element>option</a></code> element with its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a>
set to true is added to the <code><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>, the user agent must set the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of all the other <code><a href=#the-option-element>option</a></code>
element in its <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> to false.</p>
elements in its <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> to false.</p>

<p>If the <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is absent and the element's
<a href=#concept-select-size title=concept-select-size>display size</a> is greater than 1, then the user agent
Expand All @@ -51849,13 +51849,15 @@ You cannot submit this form when the field is incorrect.</samp></pre>
<code><a href=#the-select-element>select</a></code> element, using the <a href=#user-interaction-task-source>user interaction task source</a> as the task
source.</p>

<p>If the <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is absent and the element's
<a href=#concept-select-size title=concept-select-size>display size</a> is 1, then whenever there are no
<code><a href=#the-option-element>option</a></code> elements in the <code><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> that have their <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true, the user agent must set the
<a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of the first <code><a href=#the-option-element>option</a></code>
element in the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> in <a href=#tree-order>tree
order</a> that is not <a href=#concept-option-disabled title=concept-option-disabled>disabled</a>, if any, to
true.</p>
<p>If <a href=#nodes-are-inserted>nodes are inserted</a> or <a href=#nodes-are-removed>nodes are removed</a> causing the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> to gain or lose one or more
<code><a href=#the-option-element>option</a></code> elements, or if an <code><a href=#the-option-element>option</a></code> element in the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> <dfn id=ask-for-a-reset title="ask for a reset">asks for a
reset</dfn>, then, if the <code><a href=#the-select-element>select</a></code> element's <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is absent, the <code><a href=#the-select-element>select</a></code>
element's <a href=#concept-select-size title=concept-select-size>display size</a> is 1, and no <code><a href=#the-option-element>option</a></code>
elements in the <code><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list title=concept-select-option-list>list of
options</a> have their <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to
true, the user agent must set the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of
the first <code><a href=#the-option-element>option</a></code> element in the <a href=#concept-select-option-list title=concept-select-option-list>list of
options</a> in <a href=#tree-order>tree order</a> that is not <a href=#concept-option-disabled title=concept-option-disabled>disabled</a>, if any, to true.</p>

<p>If the <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is present, and the element
is not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>, then the user agent should allow the
Expand All @@ -51868,8 +51870,9 @@ You cannot submit this form when the field is incorrect.</samp></pre>
source.</p>

<p>The <a href=#concept-form-reset-control title=concept-form-reset-control>reset algorithm</a> for <code><a href=#the-select-element>select</a></code>
elements is to go through all the <code><a href=#the-option-element>option</a></code> elements in the element's <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>, and set their <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> to true if the <code><a href=#the-option-element>option</a></code> element
has a <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute, and false otherwise.</p>
elements is to go through all the <code><a href=#the-option-element>option</a></code> elements in the element's <a href=#concept-select-option-list title=concept-select-option-list>list of options</a>, set their <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> to true if the <code><a href=#the-option-element>option</a></code> element
has a <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute, and false otherwise, and then
have the <code><a href=#the-option-element>option</a></code> elements <a href=#ask-for-a-reset>ask for a reset</a>.</p>

</div>

Expand Down Expand Up @@ -52030,6 +52033,10 @@ You cannot submit this form when the field is incorrect.</samp></pre>
options</a> whose <a href=#concept-option-index title=concept-option-index>index</a> is the given new value, if
any, must have its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true.</p>

<p class=note>This can result in no element having a <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true even in the case of the
<code><a href=#the-select-element>select</a></code> element having no <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute
and a <a href=#concept-select-size title=concept-select-size>display size</a> of 1.</p>

<p>The <dfn id=dom-select-value title=dom-select-value><code>value</code></dfn> IDL attribute, on getting, must
return the <a href=#concept-option-value title=concept-option-value>value</a> of the first <code><a href=#the-option-element>option</a></code>
element in the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> in <a href=#tree-order>tree
Expand All @@ -52042,6 +52049,10 @@ You cannot submit this form when the field is incorrect.</samp></pre>
options</a>, in <a href=#tree-order>tree order</a>, whose <a href=#concept-option-value title=concept-option-value>value</a>
is equal to the given new value, if any, must have its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true.</p>

<p class=note>This can result in no element having a <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true even in the case of the
<code><a href=#the-select-element>select</a></code> element having no <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute
and a <a href=#concept-select-size title=concept-select-size>display size</a> of 1.</p>

<p>The <dfn id=dom-select-multiple title=dom-select-multiple><code>multiple</code></dfn>, <dfn id=dom-select-required title=dom-select-required><code>required</code></dfn>, and <dfn id=dom-select-size title=dom-select-size><code>size</code></dfn> IDL attributes must <a href=#reflect>reflect</a> the
respective content attributes of the same name. The <code title=dom-select-size><a href=#dom-select-size>size</a></code> IDL
attribute has a default value of zero.</p> <!-- see bug 12288 for compat reasons why .size allows
Expand Down Expand Up @@ -52458,7 +52469,7 @@ interface <dfn id=htmloptionelement>HTMLOptionElement</dfn> : <a href=#htmleleme
<p>The <dfn id=dom-option-selected title=dom-option-selected><code>selected</code></dfn>
IDL attribute, on getting, must return true if the element's <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> is true, and
false otherwise. On setting, it must set the element's <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> to the new
value.</p>
value, and then cause the element to <a href=#ask-for-a-reset>ask for a reset</a>.</p>

<p>The <dfn id=dom-option-index title=dom-option-index><code>index</code></dfn> IDL
attribute must return the element's <a href=#concept-option-index title=concept-option-index>index</a>.</p>
Expand Down

0 comments on commit 00c9d0c

Please sign in to comment.