Bug Tracker

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#11872 closed bug (wontfix)

$('option:enabled') does not work in Chrome

Reported by: edelman.jason@… 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

Change History (8)

comment:1 Changed 7 years ago by edelman.jason@…

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.

comment:2 Changed 7 years ago by sindresorhus

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.

comment:3 Changed 7 years ago by sindresorhus

Apparently this has been fixed in Chrome Canary 21, so expect a fix for this in a month or two ;)

comment:4 Changed 7 years ago by timmywil

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.

comment:5 Changed 7 years ago by timmywil

Resolution: fixed
Status: reopenedclosed

comment:6 Changed 7 years ago by timmywil

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.

comment:7 Changed 7 years ago by timmywil

Milestone: 1.8None
Resolution: wontfix
Status: reopenedclosed

comment:8 Changed 7 years ago by anonymous

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.

Note: See TracTickets for help on using tickets.