Bug Tracker

Opened 9 years ago

Closed 9 years ago

#9538 closed bug (invalid)

Discrepancy between jQ 1.5 vs 1.6 in selected attribute in DOM

Reported by: n3croman@… Owned by: n3croman@…
Priority: low Milestone: 1.next
Component: attributes Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:

Description

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 9 years ago by Rick Waldron

Component: unfiledattributes
Owner: set to n3croman@…
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 9 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 9 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.