Skip to content

removeAttr("selected") should not set property to false #1759

@mgol

Description

@mgol

Originally reported by wchen@… at: http://bugs.jquery.com/ticket/14633

 http://jsfiddle.net/b85D4/5/

In Firefox the selected value is 1. In Chrome the selected value is 2.

removeAttr has special handing for boolean attributes to set the corresponding DOM property to false:  https://github.com/jquery/jquery/blob/master/src/attributes/attr.js#L86

Removing an attribute and setting the DOM property to false are very different. In this case, as specified ( http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#dom-option-selected), setting the property to false means setting the dirtiness to true. This changes how the option should react to "selected" attribute changes. In the test case, it means that adding the "selected" attribute at the end should not select the option.

Firefox respects the specified behaviour and does not select the second option.

Issue reported for jQuery 2.0.3

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions