Bug Tracker

Ticket #3951 (closed enhancement: invalid)

Opened 6 years ago

Last modified 4 years ago

New /= regex filter

Reported by: shazam Owned by: john
Priority: low Milestone:
Component: selector Version: 1.4.3
Keywords: regex filter Cc:
Blocking: Blocked by:

Description

A regex attribute filter that might be very useful for xml data search. Done with little ATTR: match and filter update.

Diff attached.

Attachments

regex selector.diff Download (1.3 KB) - added by shazam 6 years ago.

Change History

comment:1 Changed 6 years ago by shazam

Sample :

$('book[author/=/moli[èe]re/i]') will match every book written by Moliere or Molière ignoring case.

comment:2 Changed 6 years ago by shazam

This new feature doesn't break any test and supports almost all regexp.

I did plenty of tests and it seems that only expressions like : $('input[name/=/foo
[bar\]/]') trying to match <input name="foo[bar]"/> doesn't work properly around the escaped
[

comment:3 Changed 6 years ago by shazam

After some more testing it appears that the problem is on expressions containing an opened
[ that is not closed. for example :

$('input[name/=/f
w{2}
[
w*
]/i]') works because it contains
] which avoid a chunk/match error (not found where it is buggy yet)

$('input[name/=/f
w{2}
[
w*/i]') doesn't work...

I'm trying to find a fix for this.

comment:4 Changed 6 years ago by shazam

Ok managed to make it work properly but i had to change the chunker regex.

I tested many regex including special chars - [](){}. - escaped or not backreferences.... everything works properly and more it does not break any test in the test suite.

Diff attached.

Changed 6 years ago by shazam

comment:5 Changed 4 years ago by dmethvin

Since Sizzle now uses querySelectorAll, any enhancement that introduces non-standard selector syntax is likely to throw warnings in the console. It happens for pseudos like :hidden and seems to be a concern when people see it, so I'd be wary of introducing features like this.

comment:6 Changed 4 years ago by snover

  • Keywords needsreview added
  • Priority changed from minor to low
  • Version changed from 1.3 to 1.4.3
  • Milestone 1.3.1 deleted

Bikeshed/feature creep

comment:7 Changed 4 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

In order to use native querySelectorAll in more cases, we need to avoid non-standard extensions to the CSS query syntax.

comment:8 Changed 4 years ago by dmethvin

  • Keywords needsreview removed
Note: See TracTickets for help on using tickets.