Skip to main content

Bug Tracker

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: Owned by:
Priority: low Milestone: None
Component: selector Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:

Here's a fiddle 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

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.

Changed June 07, 2012 12:06PM UTC by sindresorhus comment:2

component: unfiledselector
priority: undecidedlow
resolution: → cantfix
status: newclosed

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 sindresorhus 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 timmywil comment:4

milestone: None1.8
resolution: cantfix
status: closedreopened

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 timmywil comment:5

resolution: → fixed
status: reopenedclosed

Changed June 07, 2012 03:04PM UTC by timmywil comment:6

resolution: fixed
status: closedreopened

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 timmywil comment:7

milestone: 1.8None
resolution: → wontfix
status: reopenedclosed

Changed June 07, 2012 05:20PM UTC by anonymous 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.