Skip to content

Instantly share code, notes, and snippets.

@subtleGradient
Created November 4, 2008 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save subtleGradient/22177 to your computer and use it in GitHub Desktop.
Save subtleGradient/22177 to your computer and use it in GitHub Desktop.
Element.implement({
matchFromRoot: function(selector){
return document.getElements(selector, true).contains(this);
}
});
myElement.match('div') // true
myElement.match('body div') // false
myElement.matchFromRoot('div') // true
myElement.matchFromRoot('body div') // true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment