[jQuery] Re: Select by containing text

2009-10-06 Thread KeeganWatkins
oops, copy/paste error. as there is no "text" method on RegExp objects, disregard the snippet above. it should be: // Existing "contains" filter function (a, i, m) { return (a.textContent || a.innerText || jQuery(a).text() || "").indexOf(m[3]) >= 0; } // New ":text-equals" filter function (a

[jQuery] Re: Select by containing text

2009-10-06 Thread KeeganWatkins
Hi Julijan, It sounds like what you need is a ":text-equals" filter The reason ":contains" fails in this case is because it does a global match. By anchoring the same RegExp against the beginning and end of the string, you should be able to select elements whose text matches exactly: // Existing

[jQuery] Re: Select by containing text

2009-10-05 Thread ryan.j
sounds like you want to .filter() the results, but that will still iterate. the thing is anything that grabs a bunch of elements and picks certain ones out is going to loop through them at some point. if you wanted to do it entirely via selectors (and depending on whether there is a appropriate a

[jQuery] Re: Select by containing text

2009-10-05 Thread ryan.j
You could just check the length of the :contains string against the .text() value in a .filter(function(){ ... }) On Oct 5, 9:20 am, Julijan Andjelic wrote: > Is there a way (selector) that would allow me to select an element by > exact mach of containing text. > > example: > > >     This is so