Skip to main content

Bug Tracker

Side navigation

#8260 closed bug (duplicate)

Opened February 13, 2011 02:23AM UTC

Closed February 13, 2011 07:19PM UTC

Last modified February 13, 2011 07:19PM UTC

.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:
Description

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

Sample is at:

http://jsfiddle.net/qjCwF/

Attachments (0)
Change History (2)

Changed February 13, 2011 07:19PM UTC by jitter comment:1

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]']")

Changed February 13, 2011 07:19PM UTC by jitter comment:2

Duplicate of #7596.