Skip to main content

Bug Tracker

Side navigation

#10271 closed bug (duplicate)

Opened September 14, 2011 02:22AM UTC

Closed September 14, 2011 03:48PM UTC

Last modified March 09, 2012 09:32PM UTC

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:
Description

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.

Attachments (0)
Change History (2)

Changed September 14, 2011 03:48PM UTC by timmywil comment:1

component: unfiledattributes
priority: undecidedlow
resolution: → duplicate
status: newclosed

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

Changed September 14, 2011 03:48PM UTC by timmywil comment:2

Duplicate of #10278.