Possible Duplicate:
Javascript isDOM — How do you check if a Javascript Object is a DOM Object?
In my code, I have an object which takes a DOM element.
Code below has been changed to their minimum in order to keep example clear.
var Test = function(element){
//if element does not come from the DOM -> throw
};
How can I be sure this element comes from the DOM tree?
if(element.parentNode === null) {
throw "not coming from the DOM";
}
Is this code enough to state element comes from DOM ?