Bug Tracker

Opened 12 years ago

Closed 12 years ago

#9538 closed bug (invalid)

Discrepancy between jQ 1.5 vs 1.6 in selected attribute in DOM

Reported by: [email protected] Owned by: [email protected]
Priority: low Milestone: 1.next
Component: attributes Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:


Check this sample: http://jsfiddle.net/jPKQz/3/ When running with jQuery 1.5 and analyzing the created DOM using Firebug/DevTools/Dragonfly/IE9, none of option tags in created select boxes contain selected="selected" attribute. When running this sample with jQuery 1.6 the first two select boxes contains selected="selected" attribute on given options - is this the expected behavior?

Change History (3)

comment:1 Changed 12 years ago by Rick Waldron

Component: unfiledattributes
Owner: set to [email protected]
Priority: undecidedlow
Status: newpending

See: http://blog.jquery.com/2011/05/12/jquery-1-6-1-released/

Also, is there anyway to reduce your test case to the smallest possible example of offending code?

comment:2 Changed 12 years ago by anonymous

http://jsfiddle.net/e57CU/ - open it in Chrome, open Dev tools and check the attributes of option tags - no selected="selected" here, although in each of select boxes an item is selected. Now change the jQuery to 1.6 and check it again, now the first select box has selected="selected" option - but why? Is this the expected behavior?

comment:3 Changed 12 years ago by timmywil

Resolution: invalid
Status: pendingclosed

Yes, this is expected default browser behavior. Previous versions of jQuery set the property (which is why it is still selected without seeing the attribute there). 1.6 sets the actual attribute which is why you see an attribute there, but the attribute is really only for setting the default/initial value. The property is what keeps track of current state.

Note: See TracTickets for help on using tickets.