test == document
obj.toString().indexOf("HTMLDocument") != -1
if (this.body && this.getElementsByTagName ){ alert("this quacks like a document!"); }
Comment