Skip to content

Commit

Permalink
[giow] (3) Move more towards the browsers for <option> selectedness v…
Browse files Browse the repository at this point in the history
…s dirtiness. This doesn't quite match any browser exactly, so all browsers would have to change to match it. If there's a reason (e.g. backcompat) to prefer a different model, please reopen the bug and let me know.

Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=23574
Affected topics: DOM APIs, HTML

git-svn-id: http://svn.whatwg.org/webapps@8297 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Nov 19, 2013
1 parent c4838ee commit 919de24
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 32 deletions.
34 changes: 24 additions & 10 deletions complete.html
Expand Up @@ -43825,6 +43825,7 @@ <h4 id=the-select-element><span class=secno>4.10.7 </span>The <dfn><code>select<

<div class=impl>

<!--CLEANUP-->
<p>If the <code title=attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is absent, and the element
is not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>, then the user agent should allow the
user to pick an <code><a href=#the-option-element>option</a></code> element in its <a href=#concept-select-option-list title=concept-select-option-list>list
Expand All @@ -43833,7 +43834,7 @@ <h4 id=the-select-element><span class=secno>4.10.7 </span>The <dfn><code>select<
through a click, or through unfocusing the element after changing its value, or through a <a href=#using-the-option-element-to-define-a-command title=option-command>menu command</a>, or through any other mechanism), and before the
relevant user interaction event <!-- interaction event spec point --> is queued (e.g. before the
<code title=event-click><a href=#event-click>click</a></code> event), the user agent must set the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of the picked <code><a href=#the-option-element>option</a></code> element
to true and then <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> that bubbles named
to true, set its <a href=#concept-option-dirtiness title=concept-option-dirtiness>dirtiness</a> to true, and then <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> that bubbles named
<code title=event-change>change</code> at the <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>

Expand All @@ -43843,13 +43844,14 @@ <h4 id=the-select-element><span class=secno>4.10.7 </span>The <dfn><code>select<
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>
elements in its <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> to false.</p>

<!--CLEANUP-->
<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
should also allow the user to request that the <code><a href=#the-option-element>option</a></code> whose <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> is true, if any, be unselected. Upon this
request being conveyed to the user agent, and before the relevant user interaction event <!--
interaction event spec point --> is queued (e.g. before the <code title=event-click><a href=#event-click>click</a></code>
event), the user agent must set the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a>
of that <code><a href=#the-option-element>option</a></code> element to false and then <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a
of that <code><a href=#the-option-element>option</a></code> element to false, set its <a href=#concept-option-dirtiness title=concept-option-dirtiness>dirtiness</a> to true, and then <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a
simple event</a> that bubbles named <code title=event-change>change</code> at the
<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>
Expand All @@ -43864,19 +43866,21 @@ <h4 id=the-select-element><span class=secno>4.10.7 </span>The <dfn><code>select<
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>

<!--CLEANUP-->
<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
user to <dfn id=concept-select-toggle title=concept-select-toggle>toggle</dfn> the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of the <code><a href=#the-option-element>option</a></code> elements in its
<a href=#concept-select-option-list title=concept-select-option-list>list of options</a> that are themselves not <a href=#concept-option-disabled title=concept-option-disabled>disabled</a> (either through a click, or through a <a href=#using-the-option-element-to-define-a-command title=option-command>menu command</a>, or any other mechanism). Upon the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of one or more <code><a href=#the-option-element>option</a></code>
elements being changed by the user, and before the relevant user interaction event <!--
interaction event spec point --> is queued (e.g. before a related <code title=event-click><a href=#event-click>click</a></code> event), the user agent must <a href=#queue-a-task>queue a task</a> to
<a href=#concept-select-option-list title=concept-select-option-list>list of options</a> that are themselves not <a href=#concept-option-disabled title=concept-option-disabled>disabled</a>. Upon such an element being <a href=#concept-select-toggle title=concept-select-toggle>toggled</a> (either through a click, or through a <a href=#using-the-option-element-to-define-a-command title=option-command>menu command</a>, or any other mechanism), and before the relevant user interaction event <!--
interaction event spec point --> is queued (e.g. before a related <code title=event-click><a href=#event-click>click</a></code> event), the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of the <code><a href=#the-option-element>option</a></code>
element must be changed (from true to false or false to true), the <a href=#concept-option-dirtiness title=concept-option-dirtiness>dirtiness</a> of the element must be set to true, and the user agent must <a href=#queue-a-task>queue a task</a> to
<a href=#fire-a-simple-event>fire a simple event</a> that bubbles named <code title=event-change>change</code> at
the <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>

<!--CLEANUP-->
<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>, 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
has a <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute, and false otherwise, set their <a href=#concept-option-dirtiness title=concept-option-dirtiness>dirtiness</a> to false, 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 @@ -44038,12 +44042,13 @@ <h4 id=the-select-element><span class=secno>4.10.7 </span>The <dfn><code>select<
in <a href=#tree-order>tree order</a> that has its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true, if any. If there isn't one,
then it must return &minus;1.</p>

<!--CLEANUP-->
<p>On setting, the <code title=dom-select-selectedIndex><a href=#dom-select-selectedindex>selectedIndex</a></code> attribute must set
the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of all the <code><a href=#the-option-element>option</a></code>
elements in the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> to false, and then
the <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> 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>
any, must have its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true and its <a href=#concept-option-dirtiness title=concept-option-dirtiness>dirtiness</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
Expand All @@ -44055,11 +44060,12 @@ <h4 id=the-select-element><span class=secno>4.10.7 </span>The <dfn><code>select<
order</a> that has its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to
true, if any. If there isn't one, then it must return the empty string.</p>

<!--CLEANUP-->
<p>On setting, the <code title=dom-select-value><a href=#dom-select-value>value</a></code> attribute must set the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> of all the <code><a href=#the-option-element>option</a></code> elements in
the <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> to false, and then 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>, 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>
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 and its <a href=#concept-option-dirtiness title=concept-option-dirtiness>dirtiness</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
Expand Down Expand Up @@ -44412,12 +44418,19 @@ <h4 id=the-option-element><span class=secno>4.10.10 </span>The <dfn><code>option

<div class=impl>

<p>The <dfn id=concept-option-dirtiness title=concept-option-dirtiness>dirtiness</dfn> of an <code><a href=#the-option-element>option</a></code> element is
a boolean state, initially false. It controls whether adding or removing the <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> content attribute has any effect.</p>

<!--CLEANUP-->
<p>The <dfn id=concept-option-selectedness title=concept-option-selectedness>selectedness</dfn> of an <code><a href=#the-option-element>option</a></code>
element is a boolean state, initially false. Except where otherwise specified, when the element is
created, its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> must be set to true if
the element has a <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute. Whenever an
<code><a href=#the-option-element>option</a></code> element's <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute is
added, its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> must be set to true.</p>
added, if its <a href=#concept-option-dirtiness title=concept-option-dirtiness>dirtiness</a> is true, its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> must be set to true.
Whenever an
<code><a href=#the-option-element>option</a></code> element's <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute is
<em>removed</em>, if its <a href=#concept-option-dirtiness title=concept-option-dirtiness>dirtiness</a> is true, its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> must be set to false.</p>

<p class=note>The <code title=dom-option><a href=#dom-option>Option()</a></code> constructor, when called with three
or fewer arguments, overrides the initial state of the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> state to always be false even if the third
Expand Down Expand Up @@ -44510,9 +44523,10 @@ <h4 id=the-option-element><span class=secno>4.10.10 </span>The <dfn><code>option
return the element's <a href=#concept-option-value title=concept-option-value>value</a>. On setting, the element's
<code title=attr-option-value><a href=#attr-option-value>value</a></code> content attribute must be set to the new value.</p>

<!--CLEANUP-->
<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, and then cause the
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, set its <a href=#concept-option-dirtiness title=concept-option-dirtiness>dirtiness</a> to true, 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
Expand Down

0 comments on commit 919de24

Please sign in to comment.