Bug Tracker

Modify

Ticket #9538 (closed bug: invalid)

Opened 2 years ago

Last modified 2 years ago

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:
Blocking: Blocked by:

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

comment:1 Changed 2 years ago by rwaldron

  • Owner set to n3croman@…
  • Priority changed from undecided to low
  • Status changed from new to pending
  • Component changed from unfiled to attributes

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 2 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 2 years ago by timmywil

  • Status changed from pending to closed
  • Resolution set to invalid

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.