- Cache
jQuery(a).text().toUpperCase()
- Split query by whitespace
- Loop over the split query, testing each one
- If you find a query member that is not contained, return false
- At loop end, return true
Also note that if you don't want to change your custom selector code, you can also write section:Contains('ABC'):Contains('DEF')
.
EDIT: Translation:
jQuery.expr[':'].Contains = function(a,i,m) {
var text = jQuery(a).text().toUpperCase(); // Cache `jQuery(a).text().toUpperCase()`
var words = m[3].split(/\s+/); // Split query by whitespace
for (var i = 0; i < words.length; i++) { // Loop over the split query, testing each one
if (-1 == text.indexOf(words[i].toUpperCase())) { // If you find a query member that is not contained,
return false; // return false
}
}
return true; // At loop end, return true
};