Bug Tracker

Ticket #3137 (assigned bug)

Opened 2 months ago

Last modified 1 month ago

Complex selectors breaking .parents() method

Reported by: eduardo Assigned to: flesler (accepted)
Type: bug Priority: major
Milestone: 1.3 Component: selector
Version: 1.2.6 Keywords:
Cc: Needs: Patch

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 (1.1 kB) - added by eduardo 2 months ago.
selectors.js (4.4 kB) - added by eduardo 2 months ago.

Change History

Changed 2 months ago by eduardo

Changed 2 months ago by eduardo

Changed 2 months ago by flesler

  • status changed from new to assigned
  • owner set to flesler

Changed 1 month ago by flesler

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

Changed 1 month ago by flesler

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

Changed 1 month ago by joern

Related to #2851

Changed 1 month ago by joern

  • description changed from 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? to 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?
Note: See TracTickets for help on using tickets.