[jQuery] Using E:contains('test') - problem when text contains spaces (plus some new selectors for :starts-with() etc)

[jQuery] Using E:contains('test') - problem when text contains spaces (plus some new selectors for :starts-with() etc)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2912" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face="Segoe UI" size=2>Hi there,</FONT></DIV>
<DIV><FONT face="Segoe UI" size=2></FONT> </DIV>
<DIV><FONT face="Segoe UI" size=2>The :contains() selector works well with most
text but fails to find a match when it contains space
characters.</FONT></DIV>
<DIV><FONT face="Segoe UI" size=2></FONT> </DIV>
<DIV><FONT face="Segoe UI" size=2>Can anyone provide a fix for matching text
such as LI:contains('hello there') in markup such as <li>blah blah hello
there blah</li> ?</FONT></DIV>
<DIV><FONT face="Segoe UI" size=2></FONT> </DIV>
<DIV><FONT face="Segoe UI" size=2>I have been uable to come up with a suitable
fix for the RegEx myself but for those interested, here are some extra custom
selectors that can be added to the JQuery.js in the $.g
declaration:</FONT></DIV>
<DIV><FONT face="Segoe UI" size=2></FONT> </DIV>
<DIV><FONT face="Segoe UI" size=2>- Case Insensitive contains() selector: (note
the upper case C to differentiate it)</FONT></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<P><FONT face="Segoe UI" size=2>Contains: "(a.innerText ||
a.innerHTML).toLowerCase().indexOf(m[3].toLowerCase()) !=
-1"</FONT></P></BLOCKQUOTE>
<DIV><FONT face="Segoe UI" size=2>- starts-with selector:<FONT size=2></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<P>'starts-with': "(a.innerText || a.innerHTML).indexOf(m[3]) ==
0"</P></BLOCKQUOTE></FONT></FONT>
<DIV><FONT face="Segoe UI" size=2>
<DIV><FONT face="Segoe UI" size=2>- Case Insensitive starts-with() selector:
(note the upper case S to differentiate it)<FONT size=2></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<P>'Starts-with': "(a.innerText ||
a.innerHTML).toLowerCase().indexOf(m[3].toLowerCase()) ==
0"</P></BLOCKQUOTE></FONT></FONT></FONT></DIV>
<DIV><FONT face="Segoe UI" size=2>Cheers all</FONT></DIV></BODY></HTML>
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/