Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#8260 closed bug (duplicate)

.filter(selector) does not select properly

Reported by: cstavro Owned by:
Priority: high Milestone: 1.next
Component: selector Version: 1.5
Keywords: Cc:
Blocked by: Blocking:


When using $(selector).filter(selector) to select and filter elements, the results are unexpected in certain situations.

Sample is at: http://jsfiddle.net/qjCwF/

Change History (2)

comment:1 Changed 12 years ago by jitter

Component: unfiledselector
Priority: undecidedhigh
Resolution: duplicate
Status: newclosed

Thanks for taking the time to contribute to the jQuery project by writing a bug report and providing a test case!

After checking your report and your test case I determined that this is a already known bug. You can check the ticket mentioned below for progress on this issue.

In case it's not clear why the "direct" selector ($(...)) works but with filter(...) doesn't or why these two bugs have indeed the same root cause:

  • The "direct" selector only works in browsers that support qSA (just try your fiddle e.g. in IE6 and notice how the 2nd and 3rd test fail).
  • The bug are the same because .filter(...) uses Sizzle also for qSA-aware browsers.

P.S.: As some other selector related bugs have been fixed for jQuery .1.5 you can work around this problem (when using 1.5) by escaping the dot in your filter selector like this .filter("[id^='Favourite[Music]\\.Song[Jazz]']")

comment:2 Changed 12 years ago by jitter

Duplicate of #7596.

Note: See TracTickets for help on using tickets.