Confused by relation between DOM and HTML (APIs)

Karolis picture Karolis · Nov 29, 2010 · Viewed 8.1k times · Source

How are DOM and HTML related? Is one subset of another, is one a more abstract concept than the another? Is HTML an extension of DOM? Or do they describe rather unrelated concepts (related only in that you can transform from HTML into DOM)? How would you draw these 2 in one picture if you had to?

For example, what is the purpose of these difference specs. Both first and last links contain information about HTMLElement..

  1. http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/
  2. http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/
  3. http://www.w3.org/TR/html5/

I found a possible answer to this question here: http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/html.html#ID-1176245063-h2, which is

The goals of the HTML-specific DOM API are:

  • to specialize and add functionality that relates specifically to HTML documents and elements
  • ...
  • to provide convenience mechanisms, where appropriate, for common and frequent operations on HTML documents.

Does this mean that the 3rd link in the list above extends the DOM Core, which is described in the 1st link?

Or if you implement DOM Core, that allows you to manipulate simple documents, but if you implement HTML, that gives you like a super-DOM that allows you to manipulate more complicated objects?

Finally, say you want to implement your own browser that is able to open only HTML5 websites (render, as well as support JavaScript). Is it enough to read the specification found in the 3rd link, or do you first need to implement everything provided in DOM and then implement HTML5 specific things?

UPDATE
I guess I'm wondering about DOM API vs HTML API vs DOM HTML API vs HTML DOM API.

Answer

Lou Franco picture Lou Franco · Nov 29, 2010

HTML is text and the DOM is the in-memory object model to represent the tree that the HTML described.