Opened 14 years ago
Closed 14 years ago
#4629 closed bug (invalid)
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 (4)
comment:1 follow-up: 2 Changed 14 years ago by
comment:2 Changed 14 years ago by
Replying to 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.
comment:3 Changed 14 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
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.
Can you attach a complete test case? Thanks.