Skip to content

Instantly share code, notes, and snippets.

@digitarald
Forked from subtleGradient/querySelector.js
Created November 6, 2008 08:12
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 digitarald/22543 to your computer and use it in GitHub Desktop.
Save digitarald/22543 to your computer and use it in GitHub Desktop.
Element.implement({
matchChild: function(selector){
return this.getElements(selector, true).contains(this);
}
});
myElement.match('div') // true
myElement.match('body div') // false
myElement.matchChild('div') // true
myElement.matchChild('body div') // true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment