upon testing filter with a function returns lots of items that aren't
nodes! But among them are the nodes in question.

                                $("[EMAIL PROTECTED]:not(.thickbox)")
                                .filter(function(el){
                                        //alert(el.href);
                                        var m =  
$.map(notthese,function(notthis){
                                                if (!el.nodeName) return false;
                                                alert(el.nodeName)
                                                if (el.href && 
el.href.indexOf(notthis)>-1) return true
                                        })
                                        //alert(m);
                                        return m;
                                })
                                .bind("click", function(){ return 
!window.open(this.href); });


On 12/14/06, Jonathan Sharp <[EMAIL PROTECTED]> wrote:
> On 12/14/06, Yehuda Katz <[EMAIL PROTECTED]> wrote:
> > If that was the case, jQuery("#main a").filter(function() { return false;
> }) would return nothing. But it doesn't. It returns the original group of
> elements. At least for me.
>
> Hm... I also tested this and filter didn't prune the list with my function
> returning false.
>
> Here's the filter function out of 1.0.3 which checks if t is a function and
> pushes the result of jQuery.grep(this, t) onto the stack.
>
> filter: function(t) {
>         return this.pushStack(
>             *SNIP*
>
>             typeof t == "function" &&
>             jQuery.grep( this, t ) ||
>
>             jQuery.filter(t,this).r, arguments );
>     },
>
> Now in the grep function it operates on the list of elements in elms. It
> calls the function we defined (fn) and if fn returns false it shouldn't add
> them to the result array.
>
> grep: function(elems, fn, inv) {
>         *SNIP*
>         var result = [];
>
>         // Go through the array, only saving the items
>         // that pass the validator function
>         for ( var i = 0; i < elems.length; i++ )
>             if ( !inv && fn(elems[i],i) || inv && !fn(elems[i],i) )
>                 result.push( elems[i] );
>
>         return result;
>     },
>
> Am I missing something here?
>
> Cheers,
> -js
>
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
>
>


-- 
Ⓙⓐⓚⓔ - יעקב   ʝǡǩȩ   ᎫᎪᏦᎬ
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to