DOMObject.firstChild inconsistencies

DOMObject.firstChild inconsistencies* - there are more examples I can point to (given a couple of hours to scour) in which Opera, FF and IE all find different children of nodes. 

 

The most obvious example is presented by all the little white space nodes between tags in the XML (or not)  parsing of a nicely typeset HTML document. By way of example, compare http://srufaculty.sru.edu/david.dailey/javascript/DOMProbe.html <http://srufaculty.sru.edu/david.dailey/javascript/DOMProbe.html>  in the above three browsers. 

 

Or, for one simple example, consider the following simple code in which FF and IE return (via alert) "HEAD", but Opera returns "SCRIPT". 

 

<html>

      <script>

      alert(document.documentElement.firstChild.nodeName)

      </script>

      <body>Hello</body>

</html>

 

I do not mean to pick on Opera here. I believe I could find examples in which any of the three pairs of above-mentioned browsers agree to the exclusion of the other one.

 

The total number of children in a given document is usually entirely different. If we wish to be able to parse a document according to what I surmise are W3C standards, then it would be nice if our browsers could agree on how many nodes there are. 

 

While XML will wish us to view all the little white space nodes as nodes, HTML has a tradition of ignorning them. I don't really care so long as the tally is the same.

 

David Dailey

------------

Note: thanks to Jim Barraud and Lachlan Hunt for suggesting a nice solution to my dilemma of how to address a bundle of concerns (see related thread "preferences for blocks of unrelated comments"). I'll post with separate subject lines and spread them out over a few days so as to avoid graph-theoretic clumping.

Received on Wednesday, 21 March 2007 02:24:48 UTC