Ticket #9424 (closed bug: duplicate)
filter('[href]') fails to match links with empty href attrs in some cases
|Reported by:||nonsensery||Owned by:||nonsensery|
(This is similar to #4873, but not the same. In this case, the selector correctly matches these elements in some cases, but not in others)
Environment: This bug occurs in jQuery 1.2 - 1.6, but the failures are different in 1.2 and 1.3. I would guess that it also affects jQuery 1.6.1, but that version is unavailable for testing. Verified in Mac Chrome 11, Firefox 4, Safari 5; IE 9.
Please see this test case: http://jsfiddle.net/Zh7ME/2/
In jQuery 1.4 - 1.6, when using the filter() method, the selector [href] fails to match a link with an href attribute with an empty value, e.g. <a href="">example link</a>, but only if there are other elements in the set. If there is a single element, filter() works correctly. Also, it appears that the selector works correctly when passed to the jQuery function itself, like: $('a[href]').
In earlier versions of jQuery (1.2 - 1.3), and in older versions of IE (7 - 8) there are different failures. You can change the jQuery version in the test case to see those failures, but (personally) I am not concerned with these environments.
To summarize, the problem is not that the selector does not work, but rather that it behaves differently under different circumstances.
- Owner set to nonsensery
- Status changed from new to pending
- Component changed from unfiled to selector
- Priority changed from undecided to high
- Status changed from new to closed
- Resolution set to duplicate