There is different node types and some « illegitime nodes » like carriage returns, tabs or other specials characters which are to avoid to work with element Nodes (see, for example, this page about the different node Types).
Then the two different following syntax give with Mozilla FireFox different firstChild Nodes !
Code:
// First syntax with line feed and carriage return
<person>
<name>A</name>
<!-- -->
</person>
// Second syntax without characters between the two element Nodes
<person><name>A</name>
<!-- -->
</person>
Then to get the first element Node of your person tag (even if the code contains comments), you have to make something like this
Code:
var j=0,x=doc.getElementsByTagName('person');
while (x.childNodes[j].nodeType!=1) j++;
var xFirstElementNode=x.childNodes[j];
Bookmarks