Skip to content

Instantly share code, notes, and snippets.

@darcyclarke
Created May 27, 2016 03:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darcyclarke/06953142c44d04910cc3ac7f3deca1cc to your computer and use it in GitHub Desktop.
Save darcyclarke/06953142c44d04910cc3ac7f3deca1cc to your computer and use it in GitHub Desktop.
A jQuery filter selector for ":missing" (ie. opposite of ":contains")
/*!
*
* jQuery :missing Plugin
* http://darcyclarke.me/articles/development/find-elements-that-dont-contain-a-string/
*
* Copyright 2016, Darcy Clarke
* Do what you want license
*
*/
jQuery.expr[':'].missing = function(elem, index, match) {
return (elem.textContent || elem.innerText || Sizzle.getText([elem]) || '').indexOf(match[3]) == -1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment