Side navigation
#11872 closed bug (wontfix)
Opened June 07, 2012 08:31AM UTC
Closed June 07, 2012 03:04PM UTC
Last modified June 07, 2012 05:20PM UTC
$('option:enabled') does not work in Chrome
| Reported by: | edelman.jason@gmail.com | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | None | 
| Component: | selector | Version: | 1.7.2 | 
| Keywords: | Cc: | ||
| Blocked by: | Blocking: | 
Description
Here's a fiddle http://jsfiddle.net/aDHen/ demo.
Expected result: 1
Actual result: 0 (in Chrome. FF/IE9 work fine)
The fiddle is 1.7.2 but I discovered it in a codebase using 1.5.0
Attachments (0)
Change History (8)
Changed June 07, 2012 08:36AM UTC by comment:1
Changed June 07, 2012 12:06PM UTC by comment:2
| component: | unfiled → selector | 
|---|---|
| priority: | undecided → low | 
| resolution: | → cantfix | 
| status: | new → closed | 
This is a querySelectorAll bug, and not jQuery specific.
document.querySelectorAll('option:enabled') will also not work.
While document.querySelectorAll('option:not([disabled])') does work.
Just use $('option:not([disabled])') and you'll be fine.
Changed June 07, 2012 12:13PM UTC by comment:3
Apparently this has been fixed in Chrome Canary 21, so expect a fix for this in a month or two ;)
Changed June 07, 2012 02:18PM UTC by comment:4
| milestone: | None → 1.8 | 
|---|---|
| resolution: | cantfix | 
| status: | closed → reopened | 
Actually, if jQuery git were updating, I'd be able to show you that this has been fixed. There is a test in the suite. We now bypass querySelectorAll in certain use cases and this is one.
Changed June 07, 2012 02:18PM UTC by comment:5
| resolution: | → fixed | 
|---|---|
| status: | reopened → closed | 
Changed June 07, 2012 03:04PM UTC by comment:6
| resolution: | fixed | 
|---|---|
| status: | closed → reopened | 
OK, I take that back. The :enabled test I had was for something else. We could fix this, but I don't think it is worth the code since Chrome will have this fixed soon enough, making our fix moot fairly quickly.
Changed June 07, 2012 03:04PM UTC by comment:7
| milestone: | 1.8 → None | 
|---|---|
| resolution: | → wontfix | 
| status: | reopened → closed | 
Changed June 07, 2012 05:20PM UTC by comment:8
Thanks for looking into this. I've never seen a ticket closed and reopened so many times! :)
I will just use the inverse in my code - ":not(:disabled)"
Thanks again, and great work with this project! This is the number 1 most essential tool in my developer toolkit.
I forgot to include my OS: I'm using Windows 7 64 bit. I'm expecting ":enabled" to select the options in the select tag that aren't disabled. Instead it's selecting nothing.