Hello,

I've encountered a bug in .filter(array)

however the bug is only visible in a complex script, and within th Firebug
Inspector (but I can assure you it breaks my script), and I was not able to
write a simple test... so you might prefer to ignore me :)

I can provide the complex test if absolutely needed, but it will need more work
than just testing this patch against the test suite, I guess.


In any case, here is the patch:

filter: function(t) {
                return this.pushStack(
                        t.constructor == Array &&
-                       jQuery.map(this,function(a){
+                       jQuery.grep(this,function(a){
                                for ( var i = 0; i < t.length; i++ )
                                        if ( jQuery.filter(t[i],[a]).r.length )
-                                               return a;
+                                               return true;
                                return false;
                        }) ||




The idea of a .filter() is to remove nodes that don't match, not to insert
'false' instead. In my tests, when I use Firebug I clearly see that the
object I receive is something like the (crazy) following:

        length: 1
        0: node0
        1: false
        2: node2


-- Fil


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to