Created
October 4, 2011 16:42
-
-
Save jvandyke/1262132 to your computer and use it in GitHub Desktop.
Function to determine if the given thing is an element.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Returns true if the given object is an element. | |
* @param thing {object/jQuery} | |
* @returns {boolean} | |
*/ | |
function isDomElement(thing) | |
// If you would like this function to handle jQuery objects. | |
if (thing && thing.jquery) { | |
thing = thing.get(0); | |
} | |
return (typeof thing === "object" && typeof thing.nodeName !== "undefined"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment