<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>23574</bug_id>
          
          <creation_ts>2013-10-21 03:46:43 +0000</creation_ts>
          <short_desc>option[selected] behavior compatibility</short_desc>
          <delta_ts>2013-12-11 17:45:23 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#the-option-element</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Kent Tamura">tkent</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>ian</cc>
    
    <cc>mike</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>94982</commentid>
    <comment_count>0</comment_count>
    <who name="Kent Tamura">tkent</who>
    <bug_when>2013-10-21 03:46:43 +0000</bug_when>
    <thetext>http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#the-option-element
&gt; Whenever an option element&apos;s selected attribute is added, its selectedness must be set to true.

This rule is not compatible with major browsers.

IE and Firefox seem to have dirty flags for option elements.  If selectedness of an option element is changed by user action or selected IDL attribute, then setAttribute(&apos;selected&apos;, ...) and defaultSelected=true have no effect.

As for Firefox, removeAttribute(&apos;selected&apos;) clears selectedness if the option element is not dirty. IE has no such behavior.

Behavior of Safari and Chrome are broken. Safari doesn&apos;t update selectedness if &apos;selected&apos; content attribute is set after parsing. Chrome sets selectedness whenever &apos;selected&apos; content attribute is updated.

Safari and Chrome are ignorable. IMO, the specification should follow IE or Firefox behavior.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95048</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-10-21 21:37:10 +0000</bug_when>
    <thetext>Do you have a test case demonstrating what you mean?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95059</commentid>
    <comment_count>2</comment_count>
    <who name="Kent Tamura">tkent</who>
    <bug_when>2013-10-22 00:31:04 +0000</bug_when>
    <thetext>here it is: http://jsfiddle.net/int32_t/nhmg6/10/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95060</commentid>
    <comment_count>3</comment_count>
    <who name="Kent Tamura">tkent</who>
    <bug_when>2013-10-22 00:40:48 +0000</bug_when>
    <thetext>IMO, Firefox behavior looks reasonable.  selected content attribute, defaultSelected IDL attribute, and selected IDL attribute of an OPTION element work like value content attribute, defaultValue IDL attribute, and value IDL attribute of an INPUT element in the &apos;value&apos; value mode.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96517</commentid>
    <comment_count>4</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-11-19 17:06:24 +0000</bug_when>
    <thetext>http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2645

Yeah, I agree that we should converge on Firefox here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96518</commentid>
    <comment_count>5</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-11-19 17:06:41 +0000</bug_when>
    <thetext>http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2646</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96533</commentid>
    <comment_count>6</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-11-19 20:19:27 +0000</bug_when>
    <thetext>What I ended up with doesn&apos;t _quite_ match Firefox, in particular around things like whether the first option of a non-multiple, size=1 &lt;select&gt; that doesn&apos;t have its first item selected should end up considering that item dirty or not, and whether setting .selected to itself should set the elemnet to dirty or not (spec says yes, Firefox says no), and whether when an element with the attribute set has its state unset due to picking another element it should go dirty or not (Firefox says yes, spec says no). Basically Firefox&apos;s model is that dirtyness is set whenever the state of the element stops matching the attribute, whereas the spec&apos;s model now is that dirtiness is set when you try to explicitly set the selectedness in some way that is not via the content attribute.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96534</commentid>
    <comment_count>7</comment_count>
    <who name="">contributor</who>
    <bug_when>2013-11-19 20:20:55 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r8297.
Check-in comment: Move more towards the browsers for &lt;option&gt; selectedness vs dirtiness. This doesn&apos;t quite match any browser exactly, so all browsers would have to change to match it. If there&apos;s a reason (e.g. backcompat) to prefer a different model, please reopen the bug and let me know.
http://html5.org/tools/web-apps-tracker?from=8296&amp;to=8297</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97465</commentid>
    <comment_count>8</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-12-11 17:45:23 +0000</bug_when>
    <thetext>FTR, r8341 fixed a couple of thinkos in that patch.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>