Browser objects are part of the Browser Object Model (BOM), the totality of non-built-in objects available in a particular browser. These objects provide the ability to examine and manipulate the browser itself, including the size and shape of its windows and its configuration information. These objects do not fall under any standard but often adhere to ad hoc structural norms that have evolved over the years.
Document objects represent the elements of the HTML (or XML) document that is currently loaded by the browser. Traditionally, different browsers have implemented different features and interfaces for manipulation of document objects, but recently these objects have been standardized by the W3C Document Object Model.
As you can see from Figure B-1, the Document Object Model falls under the umbrella of the objects provided by the browser. For this reason, early Document Object Models were highly browser-specific, in fact so intertwined with the BOMs that there is really little use trying to specify the two separately.
This is the basic object model common to all scriptable browsers. It was implemented in Netscape 2 and Internet Explorer 3 and is shown in Figure B-2. This model has only limited support for events.
Netscape 3 makes more parts of the page available to scripts and includes for the first time the ability to dynamically manipulate images through its images collection. Also scriptable are Java applets (via the applets collection and LiveConnect features) and embedded objects. This browser also provides MIME type and plug-in sensing. Its object model is shown in Figure B-3.
The model of Internet Explorer 3 is essentially that of the traditional object model and is shown in Figure B-4.
Netscape 4 adds the first primitive DHTML capabilities by exposing the proprietary <layer> element to scripts. This browser also has a more robust event model where events begin at the top of the hierarchy and trickle down to the target element, affording intervening objects the opportunity to handle or redirect the event. While it might appear that dynamic manipulation of style is possible, most parts of the page will not reflect changes to their style once the page has been loaded.
This model is shown in Figure B-5.
Internet Explorer 4 marks the point at which DHTML capabilities begin to come of age. This browser exposes all parts of the page to scripts through the all collection. The event model features event bubbling, where events begin their life cycle at the element at which they occur and bubble up the hierarchy, affording intervening elements the opportunity to handle or redirect the event. This model is shown in Figure B-6.
Although later versions of Internet Explorer add a tremendous amount of new features, the core aspects of the IE Document Object Model remain essentially the same.
Support for DOM properties and methods matures gradually in versions of Internet Explorer but occurs all at once in Netscape with version 6. Netscape 6 keeps the so-called DOM0 document objects, basically those found in the traditional model, and adds support for W3C DOM methods. Internet Explorer 5.5 provides decent support for parts of the DOM as well, and Internet Explorer 6 claims to be DOM-compliant, although both 5.5 and 6.0 still provide the model of IE4 for backward compatibility.
In this modern model all parts of the page are scriptable, and the document is represented as a tree. Access to elements and attributes is standardized, as are a core set of properties and methods for document objects that largely reflect their corresponding element’s HTML 4 attributes as discussed in the following sections.