Skip to main content

Bug Tracker

Side navigation

#9538 closed bug (invalid)

Opened June 07, 2011 12:26PM UTC

Closed June 08, 2011 04:03PM UTC

Discrepancy between jQ 1.5 vs 1.6 in selected attribute in DOM

Reported by: Owned by:
Priority: low Milestone:
Component: attributes Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:

Check this sample:

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?

Attachments (0)
Change History (3)

Changed June 07, 2011 02:07PM UTC by rwaldron comment:1

component: unfiledattributes
owner: →
priority: undecidedlow
status: newpending


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

Changed June 08, 2011 03:32PM UTC by anonymous comment:2 - 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?

Changed June 08, 2011 04:03PM UTC by timmywil comment:3

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.