Re: HTML APIs

Mike Champion wrote:
> 
> Building DOM nodes for elements that logically must exist in an 
> HTML document but may not actually exist as tags in the source 
> text *is* the job of a DOM implementation. I don't think it 
> matters if these fixups are done "eagerly" when the document 
> is created or "lazily" when someone asks for one of the 
> elements that were implied.

In a schematic way of thinking, you can say that the HTML document goes
through the HTML parser, which adds all the omitted tags, default
attribute values, etc and is turned into the structure model (that
internal representation of the document which the DOM implementation
uses). The DOM functions, methods, etc then act on this structure model,
not on the source document. So by the time the DOM gets to the document,
all the missing pieces have already been filled in by the parser. 

Rules for omitted tags are strict and there will be no problems if these
are omitted following the strict rules. Where problems come in is with
broken documents which don't follow these rules. For example, omitting
the <HTML> and </HTML> tags shouldn't cause any problems, because an
HTML user agent that understands HTML 4.0 will know to put these in. But
overlapping tags, for example, do cause problems, because they are not
valid in HTML 4.0. Many HTML tools try to fix up broken documents, and
do it in varying ways. The DOM will act on the document after it has
been fixed up, which means you will get varying results in different
HTML tools.

Lauren

Received on Monday, 4 January 1999 12:42:40 UTC