Inconsistent behavior with :selected and [selected] when using filter, not
|Reported by:||jamietre||Owned by:|
This bug exists in version of jQuery available on jsFiddle later than 1.2.6. It works in 1.2.6.
It also works in Internet Explorer <8. IE8 proper doesn't work, but in a different way: 'option[selected]' returns no results. IE9, Firefox, Chrome all return the same wrong results.
NOTE: I am not actually sure what the correct behavior should be for [selected] vs. :selected. However, regardless of whether they should return the same elements, there is still a bug, since the results are not consistent depending on the way in which the selectors are used (regular selector, filter, not).
Explanation of the problem: From the fiddle above, tests 1 and 2 return different results, yet tests 6 and 7, using the same selectors except with "filter" for the 2nd clause, return different resutls.
Additionally, tests 4 and 5 return the same results when excluding the same selectors as 1 and 2.
So either ":selected" and "[selected]" should return the same results, or alternatively, they should be consistent in what they return regardless of context.
if "[selected]" is only supposed to return items with a true "selected" attribute, versus things that are considered "selected", then it's not working when used in "filter" and "not" - it behaves the same as ":selected". If it is supposed to return the same thing, then it's not working in the normal selector.
Change History (3)
comment:2 Changed 4 years ago by dmethvin
- Component changed from unfiled to selector
- Priority changed from undecided to low
- Status changed from new to open