Bug Tracker

Opened 9 years ago

Closed 9 years ago

#11116 closed bug (invalid)

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

Reported by: r_rom@… Owned by: r_rom@…
Priority: low Milestone: None
Component: attributes Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:


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.

Change History (2)

comment:1 Changed 9 years ago by sindresorhus

Owner: set to r_rom@…
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.

comment:2 Changed 9 years ago by timmywil

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/.

Note: See TracTickets for help on using tickets.