This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 18628 - :enabled pseudo-class is implemented uniformly, but differs from the spec
Summary: :enabled pseudo-class is implemented uniformly, but differs from the spec
Status: RESOLVED WORKSFORME
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-20 20:21 UTC by Micah Snyder
Modified: 2012-08-30 18:23 UTC (History)
2 users (show)

See Also:


Attachments

Description Micah Snyder 2012-08-20 20:21:19 UTC
In the WHATWG spec for :enabled it specifies "input elements whose type attribute are not in the Hidden state and that are not disabled". Ref: http://www.whatwg.org/specs/web-apps/current-work/multipage/selectors.html#selector-enabled

However, the querySelectorAll implementation for every major browser I've tested (OSX 10.7.4 - Safari 6, Chrome 21, Firefox 12. Win8 - IE9, IE10) ignores the hidden state of the element. Test case here: http://jsfiddle.net/duHdp/1/

This seems like kind of a weird one. The spec says one thing, which makes sense, but it's uniformly implemented across browsers in a way that doesn't conform to the new spec (Aside: The original W3C Selectors spec makes no mention of hidden attributes, which I think is how this implementation difference came about).

To make things even more interesting, many CSS selector engines written in JS (like Sizzle) implement the WHATWG version, so if you're using jQuery in a browser that supports qSA you'll get a different result set than if you ran the exact same selector in a browser that doesn't support qSA.

I don't know the right answer here -- whether browsers should change to conform to WHATWG or the spec and the JS implementations should change to conform to browser behavior -- but I figured it's a bug and should be raised.
Comment 1 Ian 'Hixie' Hickson 2012-08-30 18:23:29 UTC
Thanks for bringing it up. It was also brought up in the WHATWG mailing list, where I resolved it by changing the spec to match browsers.