Here's a version (with call!) that allows you to
return whatever you like to the chain. If you return
undefined, it returns the original jQuery object unmodified.

jQuery.fn.extend({
    condition: function() {
        var i, test, result;
        for (i=0; i<arguments.length; i=i+2) {
            test = typeof(arguments[i])==='function' ? arguments
[i].call(this) : arguments[i] ;

            if (!arguments[i+1]) {
                result = test;
                break;
            }

            if (test) {
                result = arguments[i+1].call(this);
                break;
            }
        }
        return result === undefined ? this : result;
    }
});
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to