DOM Level 2 Conformance Test

Monday November 20th, 2000

Bob Clary writes, "I have written a DOM Core Level 2 Conformance test which can be run with both Mozilla/Netscape 6 and Internet Explorer 5.5. It uses only the DOM methods and does not depend upon the HTMLDocument or the XML Parser. The test coverage is not yet complete but is nevertheless extensive. I think you will find the results interesting.

"The test generates two sets of reports: one by test case and one by API name. It is completely interactive and contains links to the relevant parts of the DOM Core 2 Recommendation as well as links to bug reports in Bugzilla. Of course there are no links to reports of Internet Explorer bugs available.

"If you run all of the tests it will use 50-60M and may take several minutes depending on your processor so be patient. If you do not have enough memory to run all of the tests at once, you can choose a subset of the test cases to run.

"If you have any problems, questions or suggestions please feel free to contact me."

UPDATE: The host for the conformance test is taking down the site due to heavy bandwidth usage. We'll let you know when the site's back online.

#9 The W3C DOM Recommendation is your friend!

by rdc

Monday November 20th, 2000 10:11 PM

You are replying to this message

Mostly I used the W3C Docs. The first thing I did ( a long time ago in the spring ) was to implement a version of the DOM 2 Core entirely in Javascript! It really helped to understand what was going on. From there I built a parser in Javascript. I don't necessarily recommend this approach however. ;)

My goal was (is) to build a cross browser middle level API to the DOM that can be used transparently by Mozilla, IE or other browsers that come close enough to supporting the DOM. To do that I needed to understand not only the DOM but how well Mozilla and IE support it. Thus the conformance testing.

What you see is still an unfinished project, but one that has gone through many stages, redesigns and rewrites. Several people have made suggestions on improving it. The change from the *instance* view of testing to the *api* view of testing is one such change.

As for the W3C DOM Documentation, they aren't so bad when you get used to them. They describe the objects (interfaces) and how to create them, how the methods and properties behave under every circumstance, essentially everything you need to know. I really wish I could document my code to the same standard of excellance.

Basically all you need is a Document to begin with. This is the W3C DOM Core Document *not* the HTML Document. In Mozilla you can create a Document using the document.implementation.createDocument interface. In IE it is more difficult since their default document isn't really an HTMLDocument descended from Document. For IE, you must use the MSXML ActiveX control to create a Document.

Once you have a Document (and therefore a DOMImplementation) you can create any instance of any object you need. Next, I found experimentation and trial and error to be quite rewarding.

Hope that helps and thanks!