Try window.document instanceof Node
in different browsers. It returns true
in IE11, GC30, FF24 and Opera17 so it should work for other Node
s, too.
In older browsers like IE8, the Node
interface is undefined
. I tested a couple of interfaces like HTMLDivElement
for div
nodes, but these are too specific, so one would have to ||
them into a very long logical expression. The most general interface that works in IE8 is Element
: window.document.body
and its child nodes are instances of Element
. Interestingly, window.document
is not an Element
(it's an HTMLDocument
).