Ticket #4621 (closed bug: invalid)
filter("...:first") expands original selector
|Reported by:||zaphod_41||Owned by:||zaphod_41|
I create a selector, then filter() that selector and put a length check on the end to see if anything matches, eg
var jSelector = $("foo"); if (jSelector.filter("bar").length > 0) ...
Which works fine. I was hoping I could avoid jQuery filtering the entire selector, by sticking a ":first" on the end of the filter (ie "hey, stop filtering on the first one you find"), eg
if (jSelector.filter("bar:first").length > 0) ...
What happened is that, even though the original selector found no matches (length ==0), the added filter suddenly returned a match (length == 1).
var jNewRows =
$("#table tr:has(td[id$=status] :contains('New'))");
--- console.log(jNewRows) sez 
var a =
--- console.log(a) sez 
var b =
--- console.log(b) sez [input#...] (single entry)
John Finlay ThoughtWorks (403-613-7008)