You are currently viewing a snapshot of taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to, please file a bug.

Mariner DOM
Mike Shaver, Chris Toshok & Nisheeth Ranjan
<, &>

Um, what's a DOM?

According to the W3C, the DOM is ``a minimal set of objects and interfaces for accessing and manipulating document objects''. Basically, it's a programmatic way to tweak the document structure, altering element order, attributes and text content. You can also create new elements (called ``Nodes'') from scratch and stick them in the document tree. Nifty stuff. Our current plans are for a JS-exposed DOM, but someone might want to do a C/C++ one as well. There's no accounting for taste.

The Level 1 Document Object Model was recently finalized. ``Core'' Level 1 DOM stuff applies to both XML and HTML. It is hoped that our DOM will as well. There are additional interfaces specified for HTML (``Level 1 HTML''), too.

What have we got?

We refer to the current JavaScript/HTML glue in Communicator 4.x as the ``Level 0'' DOM. That's already in place. More exciting, though, is new stuff that was recently checked into the tree. The pieces are:

  • libdom. libdom is a generic JS DOM interface, designed for connecting to HTML or XML parsers and document models. It's a big pile of JavaScript engine code to expose DOM interfaces and do much of the dirty work (like node reordering and text tweaking). To use it, you have to register a pile of callbacks and then start building nodes to match your document tree. It's not yet complete, but lots of stuff is there. Nothing that's added to this library should depend on the Mozilla HTML or XML engine; portability and modularity are major design goals.

  • lm_dom.c. This code is part of libmocha, the big hairball that ties layout to JS. Oh, and netlib and imglib and Java when it's there. It's big fun. lm_dom.c is the code that builds the DOM tree for layout. It's got all the callbacks that tweak layout structures and so forth.

  • layout. layout is where the fun really is. All the reflow and visual feedback stuff happens in here. layrelay.c is especially interesting.

Show me!

Simple instructions on how to play with the DOM stuff:

  1. Update your tree via CVS. (This stuff is recent. Some of the bits only went in this morning, for example.)
  2. Build normally, but set the DOM flag. In Unix you do something like:
    $ setenv DOM 1
    Windows and Mac instructions coming as soon as someone fixes the build systems on those platforms to make it go. (You have to build the stuff in lib/libdom, as well as adding -DDOM=1 when building lib/layout and lib/libmocha.)

    There are demos.

    Mike Shaver
    Last modified: Fri Aug 28 11:04:18 EDT 1998