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

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>88749</bug_id>
          
          <creation_ts>2012-06-10 21:30:21 -0700</creation_ts>
          <short_desc>HTMLSelectElement::selectedOptions returns wrong collection</short_desc>
          <delta_ts>2012-06-27 18:36:15 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://jsfiddle.net/f39cC/5/</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar, WebExposed</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Kent Tamura">tkent</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>benjamin</cc>
    
    <cc>jonlee</cc>
    
    <cc>menard</cc>
    
    <cc>michelangelo</cc>
    
    <cc>mitz</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>tonikitoo</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>645717</commentid>
    <comment_count>0</comment_count>
    <who name="Kent Tamura">tkent</who>
    <bug_when>2012-06-10 21:30:21 -0700</bug_when>
    <thetext>http://code.google.com/p/chromium/issues/detail?id=131890

1. Open http://jsfiddle.net/f39cC/5/
2. Select One, then add Two to the selection, then Three
3. Select Two only

What is the expected result?
The following results are respectively expected: &quot;One&quot;, &quot;One,Two&quot;, &quot;One,Two,Three&quot;, &quot;Two&quot;.

What happens instead?
We get &quot;One&quot;, &quot;One&quot;, &quot;One,Two&quot;, &quot;Two,,&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>649930</commentid>
    <comment_count>1</comment_count>
    <who name="Kent Tamura">tkent</who>
    <bug_when>2012-06-14 23:47:20 -0700</bug_when>
    <thetext>I&apos;ll roll out http://trac.webkit.org/changeset/110340 because this feature is incomplete at all.
For example, If we change select-selectedOptions.html so that

debug((++i) + &quot;) Select an option should update the selected options collection.&quot;);
mySelect.options[0].selected = true;
shouldBe(&quot;mySelect.selectedOptions.length&quot;, &quot;1&quot;); // reorder these two lines
shouldBe(&quot;mySelect.options.length&quot;, &quot;2&quot;); // ditto.
shouldBe(&quot;mySelect.selectedOptions[0].text&quot;, &quot;&apos;one&apos;&quot;);

the test fails.

HTMLCollection invalidates the content if domTreeVersion is changed. But selected state change doesn&apos;t update domTreeVersion.  The test works accidentally because shouldBe() updates domTreeVersion.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>649951</commentid>
    <comment_count>2</comment_count>
    <who name="Kent Tamura">tkent</who>
    <bug_when>2012-06-15 00:13:51 -0700</bug_when>
    <thetext>Committed r120413: &lt;http://trac.webkit.org/changeset/120413&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>650199</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2012-06-15 08:13:20 -0700</bug_when>
    <thetext>&lt;rdar://problem/11676534&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>657981</commentid>
    <comment_count>4</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2012-06-26 14:15:52 -0700</bug_when>
    <thetext>This rollout broke Garden-o-matic.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>657983</commentid>
    <comment_count>5</comment_count>
    <who name="Alexis Menard (darktears)">menard</who>
    <bug_when>2012-06-26 14:18:38 -0700</bug_when>
    <thetext>The rollout is overkill. I can just fix the bug. Now I will need to land again the feature + fix it :(.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>658194</commentid>
    <comment_count>6</comment_count>
    <who name="Alexis Menard (darktears)">menard</who>
    <bug_when>2012-06-26 18:09:39 -0700</bug_when>
    <thetext>(In reply to comment #5)
&gt; The rollout is overkill. I can just fix the bug. Now I will need to land again the feature + fix it :(.

For the record :

http://jsfiddle.net/f39cC/20/

works fine.

What seems to get crazy is when using :

output.innerHTML = ([]).map.call(this.selectedOptions, function(so) {return so.value;}).join();
console.log(([]).map.call(this.selectedOptions, function(so) {return so.value;}).join());

together. Using one of them at a time is fine.

&quot;because this feature is incomplete at all.&quot;

Well we just spotted a bug, but as the jsfiddle shows the basic use case work.

We do have a problem I agree with that and it&apos;s related to the selected state not invalidating properly the selectedOptions collection.

Also I couldn&apos;t reproduce with the suggestion of comment #1 unless I missed something.

I do have a patch here to fix the original issue, I&apos;ll cleanup and upload tomorrow.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>658208</commentid>
    <comment_count>7</comment_count>
    <who name="Kent Tamura">tkent</who>
    <bug_when>2012-06-26 18:27:47 -0700</bug_when>
    <thetext>I&apos;m sorry for rolling out.  I was too aggressive. I wanted to resolve this issue before Chromium M21 branch, and the bug had no response for four days.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>658227</commentid>
    <comment_count>8</comment_count>
    <who name="Alexis Menard (darktears)">menard</who>
    <bug_when>2012-06-26 18:39:29 -0700</bug_when>
    <thetext>(In reply to comment #7)
&gt; I&apos;m sorry for rolling out.  I was too aggressive. I wanted to resolve this issue before Chromium M21 branch, and the bug had no response for four days.

I&apos;m on IRC, don&apos;t hesitate to ping me. For some reason you CC me but it was in my &quot;to read&quot; bugzilla folder, sorry to have missed the email.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>659071</commentid>
    <comment_count>9</comment_count>
    <who name="Alexis Menard (darktears)">menard</who>
    <bug_when>2012-06-27 18:36:15 -0700</bug_when>
    <thetext>(In reply to comment #8)
&gt; (In reply to comment #7)
&gt; &gt; I&apos;m sorry for rolling out.  I was too aggressive. I wanted to resolve this issue before Chromium M21 branch, and the bug had no response for four days.
&gt; 
&gt; I&apos;m on IRC, don&apos;t hesitate to ping me. For some reason you CC me but it was in my &quot;to read&quot; bugzilla folder, sorry to have missed the email.

I fixed the bug.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>