Please take a look at the example: http://jsfiddle.net/HHDpK/1/
As you see the difference between two choosers is only the line
$("#chooser-1 .y").removeAttr("selected");
But as a result their states are different (especially in Chrome).
Am I missing anything, or it is a bug?
Looks like internal bug of jQuery with attributes.
Note that in older versions, before
.prop()was introduced in 1.6 version, it works as expected.In the newer versions, just use
.prop()to deal with such properties of elements:jsFiddle update.
More than that – using
.removeProp("selected")on the element selected previously withprop()will cause the original selection to return instead of having nothing selected – ideal behavior.