Oh, I'm sorry I didn't notice this before...
:contains() treats the parens as string delimiters. So you don't need
quotes around the string:
:contains(Subject)
or
:contains(This is a longer string)
If you do wrap the string in quotes, QueryPath looks for the quotes.
In other words, :contains('Subject') only matches the pcdata
<element>'subject'</element>.
I wrote it this way based on the CSS 3 selector spec. If jQuery
behaves differently, though, then I would definitely consider
stripping the quotes before doing the matching.
On a related note, I discovered a bug while looking into this issue.
The escape character inside of pseudoclasses is a backslash. Thus, you
should be able to do :contains(\)) to search for elements that have
pcdata ). However, for some reason the backslash is not correctly
removed.
http://github.com/technosophos/querypath/issues#issue/12
Matt