Reputation: 247
In an earlier question (http://bit.ly/KNMN89), I encountered an issue caused by IE7's broken implementation of setAttribute(). At the same time, while testing out the problem, I discovered this:
In IE7,
document.documentElement
,document.getElementsByTagName('html')[0]
, anddocument.body.parentNode
do not return [object HTMLHtmlElement] as other browsers do but return [object] instead.
Being a Javascript newbie, I am not sure what this means: does this mean that IE7 does not read the <html> element correctly as the root of the DOM? Or is it simply a case of returning the wrong value? Also, what would be the implication, if any, of such a difference to designers/developers?
I am guessing that this probably isn't a huge issue, but I'd like to at least know what's going on before moving on, rather than simply ignoring this anomaly. I'd really appreciate if Javascript veterans here can give me some related advice. Thanks in advance.
Upvotes: 0
Views: 109
Reputation: 324820
This is simply because objects convert to the string [object]
in IE7, without specifying what type of object. Furthermore, IE7 does not have the HTML*Element
object types. However, document.documentElement
and document.getElementsByTagName('html')[0]
both return the <html>
element that is the root of the document.
Upvotes: 1