Bug Tracker

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#10271 closed bug (duplicate)

optionEl.attr('selected', false) messes up the DOM in WebKit browsers

Reported by: IgorMinar Owned by:
Priority: low Milestone: None
Component: attributes Version: 1.6.4rc1
Keywords: Cc:
Blocked by: Blocking:


I have a piece of code that removes "selected" attribute from an option list and it stopped working when I upgraded from jQuery 1.4.2 to 1.6.4. After a plowing through my and jQuery code I found the bug in jQuery. Here is an annotated stack trace:

boolHook.set() at jquery.js:2445   <= "" value fails the test on line 2445 and jQuery adds the attribute back
jQuery.extend.attr() at jquery.js:2286        <= we are back in attr(), but this time with "" as the value instead of false
jQuery.extend.removeAttr() at jquery.js:2313   <= calls jQuery.attr(optionEl, "")
boolHook.set() at jquery.js:2447           <= "selected" is gets boolHook, which calls removeAttr(optionEl, "selected")
jQuery.extend.attr() at jquery.js:2286
jQuery.extend.access() at jquery.js:842
jQuery.fn.extend.attr() at jquery.js:1957
(anonymous function)() at widgets.js:891  <= I call optionEl.attr('selected', false)
Scope.$digest() at Scope.js:355
Scope.$apply() at Scope.js:520
scope.$watch.optionGroups.() at widgets.js:768    <= my code is called
jQuery.event.handle() at jquery.js:3001
jQuery.event.add.elemData.handle.eventHandle() at jquery.js:2635  <= an event fires

The end result is that the parent select element's value in WebKit browsers is set to "" even if there is another option with proper "selected" attribute. For some reason, FF is immune to this issue.

Change History (2)

comment:1 Changed 11 years ago by timmywil

Component: unfiledattributes
Priority: undecidedlow
Resolution: duplicate
Status: newclosed

An issue was introduced in the boolHook for non-IE browsers.

comment:2 Changed 11 years ago by timmywil

Duplicate of #10278.

Note: See TracTickets for help on using tickets.