Skip to content

Instantly share code, notes, and snippets.

@paulirish
Forked from padolsey/gist:380481
Created May 17, 2010 04:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save paulirish/403386 to your computer and use it in GitHub Desktop.
Save paulirish/403386 to your computer and use it in GitHub Desktop.
// Idea from http://dbaron.org/log/20100424-any
jQuery.expr[':'].any = function(el, i, match) {
return jQuery.find.matches(match[3], [el]).length > 0;
};
jQuery('body :any(div, form) p'); // Same as jQuery('body div p, body form p')
jQuery('div:any(.foo,.bar)'); // Same as jQuery('div.foo, div.bar')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment