Skip to main content

Bug Tracker

Side navigation

#4629 closed bug (invalid)

Opened May 06, 2009 02:49AM UTC

Closed May 09, 2009 03:54PM UTC

Enabled Filter Behavior Different Between IE and Firefox

Reported by: rnspiller Owned by: john
Priority: minor Milestone: 1.4
Component: selector Version: 1.3.2
Keywords: enabled filter Cc:
Blocked by: Blocking:
Description

Using the following selector has different behaviors between IE8(8.0.6001.18762) and Firefox3(3.0.10):

$('.someClass:enabled)

This was being used to select anchor tags that had the specified class but were not disabled. In IE8, this returned the wrapped set that I expected. In Firefox, it returned an empty wrapped set.

Attachments (1)
Change History (3)

Changed May 06, 2009 02:56AM UTC by dmethvin comment:1

Can you attach a complete test case? Thanks.

Changed May 06, 2009 03:47PM UTC by rnspiller comment:2

Replying to [comment:1 dmethvin]:

Can you attach a complete test case? Thanks.

I attached a test case. I do realize now that my markup is poor in that the disabled attribute is not valid for anchor tags. In any event, my point is more that the behavior of jQuery is different between IE and Firefox.

I hope that this is helpful.

Changed May 09, 2009 03:54PM UTC by dmethvin comment:3

resolution: → invalid
status: newclosed

Agreed on the markup part, since links can't be disabled but form elements can:

http://www.w3.org/TR/html401/struct/links.html#h-12.2

http://www.w3.org/TR/html401/interact/forms.html#h-17.12.1

The test in Sizzle looks for a

disabled
property (not attribute):

return elem.disabled === true;

I suspect IE8 is applying their "convert property to attribute" logic for all elements rather than just form input elements, and Firefox is doing it the right way.

The jQuery docs show examples using the selector

input:disabled
:

http://docs.jquery.com/Selectors/enabled

If you use it that way (only testing form input elements or not putting invalid attributes on other elements) it works fine. The issue here is what should happen for the case of elements that have a

disabled
attribute when they shouldn't, but that seems like undefined behavior territory to me.