Bug Tracker

Modify

Ticket #3137 (closed bug: fixed)

Opened 6 years ago

Last modified 5 years ago

Complex selectors breaking .parents() method

Reported by: eduardo Owned by: flesler
Priority: major Milestone: 1.3
Component: selector Version: 1.2.6
Keywords: Cc:
Blocking: Blocked by:

Description (last modified by joern) (diff)

If you try to do:

$('body').parents('#fakeId div');

this query should returns 0 elements, but this returns the <html> node.

I found probably a bug on multiFilter method on core, the regex is breaking some selectors.

old regex: expr = f.t.replace(/^\s*,\s*/, "" );

fix for this bug: expr = f.t.replace(/^\s*,?\s*/, "" );

I write a selector test case, and after this change all selectors has passed.

Anyone can confirm is it okay?

Attachments

selectors.html Download (1.1 KB) - added by eduardo 6 years ago.
selectors.js Download (4.4 KB) - added by eduardo 6 years ago.
multiFilter_patch.js Download (1.8 KB) - added by mike.helgeson 6 years ago.

Change History

Changed 6 years ago by eduardo

Changed 6 years ago by eduardo

comment:1 Changed 6 years ago by flesler

  • Owner set to flesler
  • Status changed from new to assigned

comment:2 Changed 6 years ago by flesler

/\s*,?\s*/ will match ANYTHING...

comment:3 Changed 6 years ago by flesler

  • need changed from Review to Patch
  • Component changed from core to selector

comment:4 Changed 6 years ago by joern

Related to #2851

comment:5 Changed 6 years ago by joern

  • Description modified (diff)

Changed 6 years ago by mike.helgeson

comment:7 Changed 5 years ago by dmethvin

  • Status changed from assigned to closed
  • Resolution set to fixed

This is fixed in 1.3

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.