Skip to main content

Bug Tracker

Side navigation

#11116 closed bug (invalid)

Opened December 29, 2011 11:25PM UTC

Closed December 30, 2011 01:37AM UTC

Trying to set attribute selected to anything sets it to "selected"

Reported by: r_rom@yahoo.com Owned by: r_rom@yahoo.com
Priority: low Milestone: None
Component: attributes Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:
Description

In my code I use img elements as tabs, and to track their states I've used an attributes that they aren't normally supposed to have: selected. I set this attribute to true or false based on the state. This used to work, but with some version it broke, and I've discovered this with version 1.7.1 of jQuery. What happens now is that when I try to set this attribute to *anything* at all, it ends up getting set to "selected".

I can change my code to work around this, but I wanted to report this because the change in jQuery has broken my previously working code.

Attachments (0)
Change History (2)

Changed December 30, 2011 12:37AM UTC by sindresorhus comment:1

owner: → r_rom@yahoo.com
status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.

Changed December 30, 2011 01:37AM UTC by timmywil comment:2

component: unfiledattributes
priority: undecidedlow
resolution: → invalid
status: pendingclosed

This is intended behavior. "selected" is the only valid value for the selected attribute. For further explanation and to familiarize yourself with a better way to work with boolean attributes, see http://api.jquery.com/prop/.