Opened 11 years ago
Closed 11 years ago
#11116 closed bug (invalid)
Trying to set attribute selected to anything sets it to "selected"
Reported by: | Owned by: | ||
---|---|---|---|
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.
Change History (2)
comment:1 Changed 11 years ago by
Owner: | set to [email protected]… |
---|---|
Status: | new → pending |
comment:2 Changed 11 years ago by
Component: | unfiled → attributes |
---|---|
Priority: | undecided → low |
Resolution: | → invalid |
Status: | pending → closed |
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/.
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.