标签:callback self 自定义 blog sel jquery div rip else
$.fn.some = function(qualifier) { var self = this; return grep(this, false, function(self, index) { return qualifier.call(self, index); }); }; $.fn.every = function(qualifier) { var self = this; return grep(this, true, function(self, index) { return qualifier.call(self, index); }); }; ? function grep(ele, isEvery, callback) { for (var i = 0; i < ele.length; i++) { if (isEvery) { if (!callback(ele[i], i)) { return false; } } else { if (callback(ele[i], i)) { return true; } } } return isEvery; }
标签:callback self 自定义 blog sel jquery div rip else
原文地址:http://www.cnblogs.com/linzb1993/p/6287947.html