filter
This method can be used to filter the elements in the collection based on a selector or a function.
// Filter the elements based on a selector
filter: function(selector) {
return $(this.elements.filter(function(element) {
return element.matches(selector);
}));
},
// Filter the elements based on a function
filter: function(fn) {
return $(this.elements.filter(function(element) {
return fn(element);
}));
}