W3C home > Mailing lists > Public > www-dom@w3.org > January to March 1999

Re: HTML APIs

From: Lauren Wood <lauren@sqwest.bc.ca>
Date: Mon, 04 Jan 1999 09:36:07 -0800
Message-ID: <3690FC07.564AD261@sqwest.bc.ca>
To: www-dom@w3.org
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:46 GMT