thanhlong203 / closure-library

Automatically exported from code.google.com/p/closure-library
0 stars 0 forks source link

bug in goog.dom.forms.setSelectSingle_ #347

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a <select> element with a couple options e.g. values "a", "b".
2. select one of the options e.g. <option value="a" select="true"> 
3. Select the other value ("b") using goog.dom.forms.setValue

What is the expected output? What do you see instead?
expected: The option with value "b" should be selected.
actual: Both "a" and "b" options are selected and the browser displays that 
selection as a blank.

What version of the product are you using? On what operating system?
svn revision 1110, chrome 11.0.696.65, windows 7. But I'm sure this is a bug on 
other browser versions as well

Please provide any additional information below.
It looks like goog.dom.forms.setSelectSingle_ (which forms.setValue calls) 
doesn't unselect the already selected value. Attached is a patch to fix this 
bug.

Original issue reported on code.google.com by chuck...@gmail.com on 14 Jul 2011 at 9:55

GoogleCodeExporter commented 8 years ago
Which browser behaves that way?
Chrome automatically unselects option "a" if "b" is selected.

Could you include a regression test?

Original comment by pall...@google.com on 14 Jul 2011 at 10:35

GoogleCodeExporter commented 8 years ago
hm...my mistake, submitted the bug report too early. I was passing "a" as an 
array ["a"] in my code and setSelectSingle_ rejected it silently since it 
checks if the second param opt_value is a string first. "a" == ["a"] is true in 
javascript and the modification I made just happens to leave out the string 
checking so it appeared to fix things.

Please close this issue.

Original comment by chuck...@gmail.com on 14 Jul 2011 at 12:37

GoogleCodeExporter commented 8 years ago

Original comment by pall...@google.com on 14 Jul 2011 at 8:01