Side navigation
#6219 closed bug (invalid)
Opened March 04, 2010 11:49AM UTC
Closed October 09, 2010 07:49PM UTC
Last modified October 01, 2012 08:55PM UTC
:contains breaks with (
Reported by: | lexxx | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | 1.4.3 |
Component: | selector | Version: | 1.4.2 |
Keywords: | contains parenthesis | Cc: | |
Blocked by: | Blocking: |
Description
if the quoted needle contains ( without a closing ), it throws an exception: uncaught exception: Syntax error, unrecognized expression:
i think finding this kind of text should be allowed
$('li:contains("xxx(yyy")'); // exception
Attachments (0)
Change History (3)
Changed October 09, 2010 07:49PM UTC by comment:1
priority: | → undecided |
---|---|
resolution: | → invalid |
status: | new → closed |
Changed October 01, 2012 08:38PM UTC by comment:2
This doesn't work:
$("td:contains('\\\\(')")
I get: "Syntax error, unrecognized expression: '\\(')"
And this doesn't work:
$("td:contains('\\(')")
I get: "Syntax error, unrecognized expression: '(')"
Changed October 01, 2012 08:55PM UTC by comment:3
This seems to work for me as of 1.8.2: http://jsfiddle.net/xnRgW/
The main reason that this isn't working is that you're not escaping the special characters (eg ") that you're trying to use in your selector. As per the jQuery documentation on selectors:
If you wish to use any of the meta-characters (#;&,.+*~':"!^$[]()=>|/@ ) as a literal part of a name, you must escape the character with two backslashes: \\\\.
Closing as invalid.