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..
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.
The Document Object Model (DOM) is an application programming interface (API) for HTML and XML documents. It defines the logical structure of documents and the way a document is accessed and manipulated.
DOM is a model of a document with an associated API for manipulating it. HTML is a markup language that lets you represent a certain kind of DOM in text.
The HTML DOM is a standard object model and programming interface for HTML. It defines: The HTML elements as objects. The properties of all HTML elements. The methods to access all HTML elements.
The DOM is not part of the JavaScript language, but is instead a Web API used to build websites. JavaScript can also be used in other contexts.
HTML is text and the DOM is the in-memory object model to represent the tree that the HTML described.
The HTML spec describes HTML in terms of a text document with a specific syntax. The DOM on the other hand describes the object-model that the browser generates, when it parses the HTML document. But both specs kind of describe the same abstract model which is the elements and attributes of HTML.
The DOM-core is the object model that is common for all XML documents (including HTML) with elements and attributes. The HTML-DOM is an extension of the core DOM with more specific interfaces for the various HTML elements.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With