The DOM HTML API
The core API works with any valid XML, including XHTML; the HTML API is specific to valid XHTML and HTML only. It consists of a set of HTML objects, each associated with a valid HTML element tag; all have properties and methods appropriate to the object.
Though a separate set of objects, the two modelsâ
core and HTMLâoverlap, with the HTML API
objects incorporating methods and properties from both models. As such,
HTML API objects inherit properties and methods of a basic HTML
Element, as well as the core
Node object (discussed in the next
The HTML Objects and Their Properties
The HTML API is a set of interfaces rather than actual classes. These interfaces can access existing or newly created page objects, and each is associated with a specific type of page object.
Iâve introduced a new term, interface. For our purposes, an interface is an object representing the specific page element. It differs from a class in that there is no constructor; objects are created through other functions rather than directly.
Most HTML interface objects inherit the properties and
methods of the
Node objectsâboth of which are part of the
core model, and discussed later in the chapter. Most also inherit from
HTMLElement, which has the
following properties (based on the set of attributes of the same name
allowed for all HTML elements):
interface object takes its name from the HTML formal element name, not necessarily ...