1. Document Object Model Requirements
Editors
Jared Sorensen, Novell, Inc.
Lauren Wood, SoftQuad, Inc.
This document defines the high-level requirements for the
Document Object Model (DOM). It is part of the Document Object Model
Specification
.
1.1. General Requirements
- References to XML and HTML documents generally
denote the physical files that contain structural
markup.
- Some requirements are not implemented in DOM Level
1. Those requirements are identified in this document
with the notation [After Level 1].
Listed below are the general requirements of the Document
Object Model.
- The Object Model is language neutral and platform
independent.
- There will be a core DOM that is applicable to
HTML, CSS and XML documents.
- The Object Model can be used to construct and
deconstruct the document.
- The Object Model will not preclude use by either
agents external to the document content, or scripts
embedded within the document.
- Consistent naming conventions must be used through
all levels of the Object Model.
- A visual UI component will not be required for a
conforming implementation of the Object Model.
- The specific HTML, CSS or XML document object
models will be driven by the underlying constructs of
those languages.
- It must be possible to read in a document and
write out a structurally isomorphic document.
- The Object Model will not expose the user to
problems with security, validity, or privacy.
- The Object Model will not preclude other mechanisms
for manipulating documents.
1.2. Structure Navigation
This refers to the navigation around a document, such as
finding the parent of a given element, or what children
elements a given parent element contains.
1.2.1. General Requirements
- All document content, including elements and
attributes, will be programmatically accessible and
manipulable.
- Navigation from any element to any other
element will be possible, except where such
navigation would compromise security.
- There will be a way to uniquely and
reproducibly enumerate the structure of static
documents.
- There will be a way to query for elements and
attributes, subject to security and privacy
considerations.
- Basic low-level functions (get first, get next,
etc.) will be provided, along with convenience
functions that build upon them, but have a
consistent access method.
1.2.2. HTML Requirements
These are specific to HTML documents.
- All elements known to the user agent are
exposed.
- Unknown tags and attributes are exposed.
- Implied elements are exposed even if not
explicitly defined in the document (e.g., HTML,
HEAD, BODY).
- There will be guidelines for the inclusion of
new elements and attributes in the object model.
1.3. Document Manipulation
- There will be a way to add, remove and change
elements and/or tags (if permitted by the Document
Type Definition and not precluded by security or
validity considerations) in the document structure.
- There will be a way to add, remove and change
attributes (if permitted by the Document Type
Definition and not precluded by security or validity
considerations) in the document structure.
- Operations (or a combination of operations) must
restore consistency before they return.
- A valid static document acted upon by the DOM
will deliver a consistent reproducible document
structure.
1.4. Content Manipulation
- There will be a way to determine the containing
element from any text part of the document (subject to
security considerations).
- There will be a way to manipulate (add, change,
delete) content.
- There will be a way to navigate content.
1.5. Event Model [After Level 1]
The event model must be rich enough to create completely
interactive documents. This requires the ability to respond
to any user action that may occur on the document.
Therefore, many of these requirements only apply if a UI
component is involved.
- All elements will be capable of generating
events.
- There will be interaction events, update events,
and change events.
- The event model will allow responses to user
interactions.
- The event delivery mechanism will allow for
overriding of default behavior.
- The event model will provide a mechanism by which
events for specific elements may be received by an
ancestor in the DOM hierarchy.
- Events are synchronous.
- Events will be defined in a platform independent
and language neutral way.
- There will be an interface for binding to
events.
1.6. Stylesheet Object Model [After Level 1]
Cascading Style Sheets (CSS) is one model for manipulating
the style of the document. The Stylesheet Object Model
exposes the ability to create, modify, and associate CSS
style sheets with the document. The stylesheet model will be
extensible to other stylesheet formats in the future.
- All style sheets will be represented in the object
model.
- There will be a CSS stylesheet model. The CSS
object model will be defined as part of a stylesheet
embedding model, where the core part of the model may be
applicable to other style languages.
- Selectors, rules and properties of individual style
sheets can be added, removed and changed.
- All elements of a CSS style can be added, removed,
and changed in the object model. This includes but is
not limited to:
- linked style sheets
- imported style sheets
- alternative style sheets
- CSS pseudo-classes and CSS
pseudo-elements
- contextual selectors
- inline styles
- all properties as defined in the CSS
specification, including but not limited to font
properties, colors, backgrounds, and box
properties.
1.7. DTD Manipulation
- [After Level 1] There will be a way
to determine the presence of a DTD.
- There will be a way to query declarations in the
underlying DTD (if available).
- [After Level 1] There will be a way
to add, remove, and change declarations in the
underlying DTD (if available).
- [After Level 1] There will be a way
to test conformance of all or part of the given
document against a DTD (if available). (See Document
Manipulation, item 3).
1.8. Error Reporting
- The DOM will provide a document-wide error
logging and reporting mechanism.
- Error reporting will be primarily via
exceptions.
- The DOM error state can be queried.
1.9. Security, Validity and Privacy [After Level 1]
Security, validity, and privacy considerations are
interrelated and entwined. DOM will initially provide simple
"sandbox" security; subsequent levels are expected to
incorporate more sophisticated mechanisms.
- Each object must be responsible for maintaining its
own internal consistency.
- It must be safe to have multiple threads
operating on the same object.
- Object locking must be incorporated to ensure
consistent results.
- It must be possible to prevent scripts on one
page from accessing another page.
- Firewall boundaries must be respected.
- It must be possible to restrict access and
navigation to specific elements.
- An external security
API will be provided.
1.10. Document Meta Information
These are requirements for information about the
document.
- There will be a way of obtaining relevant
information about the document and its
embedded objects such as source location, date
created, and associated cookies.
1.11. UA Information
These are requirements for information about the user agent
environment, if applicable.
- There will be a way of obtaining relevant
information about the display environment, including
the UA brand information and version number, and,
where appropriate, the HTTP header.
- [After Level 1] A way of determining
support for a MIME type will be available.