Re: isElement - determining if an object is an element



Lasse Reichstein Nielsen wrote:
RobG <rgqld@xxxxxxxxxxxx> writes:
That causes IE8 Beta 1 to barf with "Element is not defined".
Modifying it to:

if (Element && (el instanceof Element))

or

if (Element) {
if (...) {


gets the same result, it wants a more explicit test:

if (typeof Element != 'undefined' && (...))

Perhaps that's documented on one of the IE8 blogs somewhere...

That's the expected behavior if there is no "Element" variable
defined.
if (Element) { // ...
only works if there *is* an Element variable, and it has a non-falsey
value.

Property, not variable. Of an object in the scope chain.


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
.