MozillaZine

DOM Level 1 Compatibility Checker

Thursday October 19th, 2000

Miloslav Nic writes in: "Jiri Znamenacek officially announced availability of his excellent DOM1 reference. Examples provided with the reference also contain javascript calls to the relevant functions of DOM1 in your browser and its comparison with expected output. A very nice compatibility checker. According to Jiri Mozilla came out best in this comparison."

#1 Wierd test suite

by jwb

Saturday October 21st, 2000 11:26 AM

Actually my nightly of Mozilla fails over half of these tests. I think that most of the failures are due to Mozilla's treatment of whitespace between tags as nodes, which the author says is "highly annoying", and I happen to agree. Why does Mozilla treat whitespace between tags as a node?

#2 Re: Wierd test suite

by nicmila

Monday October 23rd, 2000 12:52 AM

This prolem is a bit more involved. Standard says: An XML processor must always pass all characters in a document that are not markup through to the application. A special attribute named xml:space may be attached to an element to signal an intention that in that element, white space should be preserved by applications.

So Mozilla does it in a standard way. But I agree that it would be much more convenient (and also standard) remove non-significant whitespaces.

Maybe it would be a good idea to look at XML canonization: http://www.w3.org/TR/2000/WD-xml-c14n-20001011 (only a working draft at this moment) and use from it everything which does not impose too large processing penalty

#3 Whitespace should stay

by MPocock

Monday October 23rd, 2000 4:48 AM

The whitespace issue depends upon whether the documents is validated or not. In the case of no validation, all white-space should be kept. This is because there is no way to know if an element contains text as a child.

Once a document is validated against a DTD or a schema, then we can decide which whitespace is there as content, and which is prety-printing stuff as the document structure tells us what children each element should have. At this point, the DOM should not contain any extraneous text nodes.

Does this make sence?

#4 Whitespace handling in Mozilla

by nicmila

Monday October 23rd, 2000 6:34 AM

I am not so sure that there should not be some cannonization. It would make the system more user friendly

You can always use entities if you want for some reasons the whitespace.

Or (from the spec) : A special attribute named xml:space may be attached to an element to signal an intention that in that element, white space should be preserved by applications. So if the XML document author cares about whitespaces he can just attach this attribute to the document root and Mozilla must behave accordingly.