W3CWD-DOM/level-one-html-971209

Document Object Model (HTML)
Level 1

W3C Working Draft 9-December-1997

This version:
http://www.w3.org/TR/WD-DOM/level-one-html-971209
Latest version:
http://www.w3.org/TR/WD-DOM/level-one-html
Previous version:
http://www.w3.org/TR/WD-DOM/level-one-html-971009
WG Chair:
Lauren Wood, SoftQuad, Inc.
Editors:
Mike Champion, ArborText
Vidur Apparao, Netscape
Scott Isaacs, Microsoft
Principal contributors:
Vidur Apparao, Netscape; Mike Champion, ArborText; Scott Isaacs, Microsoft; Arnaud Le Hors, W3C; Gavin Nicol, INSO; Peter Sharpe, SoftQuad, Inc.; Bill Smith, Sun Microsystems Inc.; Jared Sorensen, Novell; Bob Sutor, IBM

Abstract

The Document Object Model (DOM) level one provides a mechanism for software developers and web script authors to access and manipulate parsed HTML and XML content. This document defines a set of objects that extends the Document Object Model (Core) such that the combination can represent all parts of a parsed HTML document. This document is meant to be concurrent with the HTML version 4.0 specification.

Status

This document is part of the Document Object Model Specification; check the W3C web site for its current status. It is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to use W3C Working Drafts as reference material or to cite them as other than "work in progress". Note: Since working drafts are subject to frequent change, you are advised to check the list of current W3C working drafts.


Introduction

This specification is part of the W3C Document Object Model, which defines a programming interface for manipulating HTML and XML documents. Objects and methods which are used for both HTML and XML documents are defined in the W3C DOM Level One Core specification, which forms the basis for the W3C DOM Level One HTML specification that you are now reading. This document extends the Level One Core specification to describe objects and methods specific to HTML documents. In general, the functionality needed to manipulate hierarchical document structures, elements, and attributes will be found in the core specification; functionality that depends on the specific elements defined in HTML will be found in this document. Another document, the W3C DOM Level One XML specification, contains methods and objects specific to XML documents.

The goals of the HTML-specific DOM specification are:

The key differences between the core DOM and the HTML application of DOM is that the HTML Document Object Model exposes a number of convenience methods and properties that are consistent with the existing models and are more appropriate to script writers. In many cases, these enhancements are not applicable to a general DOM because they rely on the presence of a predefined DTD. For DOM Level 1, the DTD for HTML 4.0 is assumed.

The W3C DOM Working Group attempts, wherever possible, to maintain compatibility with the DOM Level 0, which is defined as being the functionality exposed in Netscape Navigator 3.0 and Microsoft Internet Explorer 3.0.

More specifically, this document includes the following specializations for HTML:

The Level 1 document does not include mechanisms to access and modify style specified through CSS-1. Furthermore, it will not define an event model for HTML documents. This functionality will be specified in a future Level of this specification. The events that are supported in Level 0 are given in the DOM Level 1 HTML ECMAScript binding for completeness; the method of defining and handling events is expected to change.

Open Issues

The following issues are still being discussed. Some are already in Level 0, and the general solution to some of these issues might be in a future version of the Core specification rather than this document.

HTML Application of Core DOM

Naming Conventions

The HTML DOM follows a naming convention for properties, methods, events, collections, and data types. All names are defined as one or more English words concatenated together to form a single string.

Properties and Methods

The property or method name starts with the initial keyword in lowercase, and each subsequent word starts with a capital letter. For example, a property that returns document meta information such as the date the file was created might be named "fileDateCreated". In the ECMAScript binding, properties are exposed as properties of a given object. In Java, properties as exposed with get and set methods.

Events

All attributes for supporting events are spelled entirely in lowercase letters. All events are prefixed with "on". Events that are exposed as properties also follow this naming convention. For example, a click event is named "onclick" and is exposed as a property named "onclick" in the object model.

HTML Document

HTMLDocument

The HTMLDocument is the root of the HTML hierarchy and contains the entire content as its descendants.

We are considering adding convenience accessors and ways to query all elements, in order to locate elements in the document easily.

Properties

NamedNodeList images
A collection of all the images in the document
NamedNodeList applets
A collection of all the <APPLET> (deprecated element) and <OBJECT> elements in the document.
NamedNodeList links
A collection of all the <AREA> and <A HREF=...> elements in the document.
NamedNodeList forms
A collection of all the forms in the document
NamedNodeList anchors
A collection of all the <A NAME=...> elements in the document. void title(in wstring title)
The title of a document
wstring referrer
Returns the URL of the page that linked to this page. This property is an empty string if the user navigated to the page directly (not through a link, eg., from a bookmark).
HTMLLocation location
Get the location object associated with the document
wstring cookie
Assigning a cookie string is in the following format: name=value; expires=date. Retrieving the cookie a semi-colon delimited list of name, value pairs for all the cookies associated with the page.
wstring fileSize
The size of the document
wstring fileCreatedDate
A string representation of the date the document was created
wstring fileModifiedDate
wstring fileUpdatedDate
The last update timestamp
HTMLElement body
The element that contains the content for the document. In documents with BODY contents, returns the BODY element, and in frameset documents, this returns the outermost FRAMESET element

LOCATION Object

The location object parses the URL for the current page into a number of properties providing easy access. The Location object is included in the HTML-specific interface because this is the way access to these properties was defined in Level 0. In a subsequent level of the DOM, the DocumentContext object will be defined as part of the core API and the Location object and these methods will probably be deprecated

Properties

wstring href
URL that acts as the base URL
wstring protocol
The protocol used to retrieve the document
wstring host
The host server address
wstring hostname
The host server name
wstring port
The IP port the server is on
wstring pathname
The document pathname
wstring search
wstring hash

Methods

void reload(in boolean flag);
Reload the entire document
void replace(in string url);

HTML Elements

Element
  |
  +--- HTMLElement
          |
          +--- Specific HTML
Elements
HTMLElement Object Hierarchy

Property Attributes

All HTML attributes are exposed as properties on the element object. The name of the exposed property always uses the naming conventions, and is independent of the case of the attribute in the source document. The data type of the property is determined by the type of the attribute as determined by the HTML 4.0 DTD. The attributes have the semantics given in the HTML 4.0 specification.

The attributes are exposed as properties for compatibility with Level 0. This usage is deprecated because it can not be generalised to all possible attribute names, as is required both for XML and potentially for future versions of HTML. We are considering how best to add, get, and remove attributes in a simple and direct way.

DTD Data Type Object Model Data Type
CDATA String
Value list (e.g.. (left | right | center)) String
one-value Value list (e.g. (border)) Boolean
Number Long Integer

The return value of an attribute that has data type that is a value list is always capitalized, independent of the case of the value in the source document. For example, if the value of the align attribute on a P element is "left" then it is returned as "Left". For attributes with the CDATA data type, the value is returned with the capitalization as in the source document.

Naming Exceptions

To avoid name-space conflicts, an attribute with the same name as a keyword in one of our chosen binding languages will be prefixed. For HTML, the prefix used is "html" and for CSS, the prefix used is "css". For example, the "for" attribute collides with loop construct naming conventions and is named "htmlFor", while the CSS float attribute collides with the float data type and is named "cssFloat".

Exposing Element Type Names (tagName)

The property that exposes the element type name will return this in uppercase. For example, the body element type name is exposed through the "tagName" property as "BODY".

HTMLElement

All HTML elements derive from this class. Elements that only expose the core attributes are represented by the base HTMLElement class. These elements are as follows:

Properties

wstring title
Advisory title
wstring lang
Language code
wstring dir
Direction for weak/neutral text

Methods

void className wstring v
Sets or returns the class attribute of the element. This attribute has been renamed due to conflicts with the class keyword exposed by many languages
wstring id HTMLStyle style
RESERVED - For getting the style property.

HTML Elements

LINK Element

The LINK specifies a media-independent link.

Properties

wstring href
The base URL
wstring charset
The character set encoding of the linked resource
wstring hreflang
Language code
wstring target
Render in this frame
wstring rel
Forward link type
wstring rev
Reverse link type
wstring type
Advisory content type
wstring media
Designed for use with specific media.
We are also considering a method that returns the current loading state of the external link if the link is being downloaded .

TITLE Element

The document title

Properties

wstring title
The specified title as a string

META Element

This contains generic meta-information about the document.

Properties

wstring httpEquiv
HTTP response header name
wstring content
Associated information
wstring name
Meta-information name
wstring scheme
Select form of content

BASE Element

Document base URL

Properties

wstring href
The URL

ISINDEX Element

This element is used to show that the document is indexed. A single line prompt is possible.

Properties

wstring prompt
Prompt message

STYLE Element

Style information - this will be the subject of a future Level.

wstring type
bool disabled
wstring media

BODY Element

The HTML document body. This element is always present in the DOM API, even if the tags are not present in the source document.

Properties

wstring background
Background texture tile image
wstring bgcolor
Background color code
wstring text
Document text color
wstring link
Color of links
wstring vlink
Color of visited links
wstring alink
Color of selected links

FORM Element

The form element encompasses behavior similar to a collection and an element. It provides direct access to the contained input elements as well as the attributes of the form element. The WG is considering a method to retrieve an entry by name or index

Properties

wstring action
Server-side form handler
wstring method
HTTP method used to submit form
wstring target
Render in this frame
wstring name
Name of frame for targeting
long length
Length (read-only)
wstring enctype
wstring acceptCharset
List of supported character sets

Methods

HTMLFormElement getElements
Returns a collection of all elements in the form

Form Controls

If the element defined in the following list is not contained within a form, the form property returns null.

SELECT Element

The select element allows the selection of an option. The contained options can be directly accessed through the select element as a collection.

Properties

long size
Number of rows visible
boolean multiple
May multiple items be selected?
wstring name
Field name
NamedNodeList options
wstring type
What kind of widget
wstring value
Property value
boolean disabled
Control unavailable in this context?
long length
Number of characters
long tabIndex
Position in tabbing order
long selectedIndex
The ordinal index of the selected item. -1 is returned if no element is selected. For multi-select list boxes, the first selected item is returned.

Methods

void add(in HTMLElement element, in HTMLElement before);
Add a new element to the Select collection
void remove(in long index)
Remove an element from the Select collection
HTMLFormElement getForm()
Returns the form the element is contained within. Returns null if not within the context of a form.

The WG is also considering adding methods that return specific items by element type name and/or ordinal index.

Option Element

A selectable choice

Properties

wstring label
For use in hierarchical menus
boolean defaultSelected
boolean disabled
Control unavailable in this context?
boolean selected
wstring value
Element content

Methods

HTMLFormElement getForm();
Get the form associated with this element

LEGEND Element

Fieldset legend

Properties

wstring align
Text alignment relative to fieldset

INPUT Element

Form control

Security Notes: Depending upon the environment the page is being viewed, the value property may be read-only for the file upload input type. For the password input type, the actual value returned may be masked to prevent unauthorized use.

Properties

wstring value
Used for radios and checkboxes
wstring name
boolean disabled
Control unavailable in this context?
wstring defaultValue
Value if not explicitly specified
long size
Size information - specific to each type of field
long maxLength
Maximum number of characters for text fields
boolean readOnly
For text and password
boolean checked
For radio buttons and check boxes - TRUE if explicitly set
boolean defaultChecked
type
src
alt
usemap
align
tabindex
accesskey
accept

Methods

HTMLFormElement getForm();
Get form containing this element

TEXTAREA Element

Multi-line text field

Properties

wstring type
wstring value
Property value
wstring name
Property name
boolean disabled
Control unavailable in this context?
wstring defaultValue
Value if no input from user
boolean readOnly
Can user change the value?
long rows
Number of text rows
long cols
Width in columns
wstring wrap
long tabindex
Position in tabbing order

Methods

HTMLFormElement getForm();
Get the form containing this element
blur()
Remove keyboard focus
focus()
Set keyboard focus
select
Select the contents of the textarea

BUTTON Element

Push button

Properties

wstring type
What kind of widget?
wstring value
Property value
wstring name
Property name
boolean disabled
Control unavailable in this context?
long tabindex
Position in tabbing order
wstring accesskey
Accessibility key character

Methods

HTMLFormElement getForm();
Get form containing this control

Label Element

Form field label text

wstring htmlFor
The HTML "for" needs to be named htmlFor. For as a property name collides with the keywords of most langauges .
wstring accessKey
Accessibility key character

Special Elements

A Element

Anchor

Properties

wstring target
Render in this frame
wstring href
URL for linked resource
wstring rel
Forward link type
wstring rev
Reverse link type
wstring name
Property name
wstring accessKey
Accessibility key character
long tabIndex
Position in tabbing order
wstring charset
Character encoding of linked resource

BASEFONT Element

Base font

Properties

wstring color
Font color
wstring face
Font face id
long size
Font size

BR Element

Forced line break

Properties

wstring clear();
Control text flow

IMG Element

Embedded image

Properties

boolean isMap
Use server-side image map
wstring useMap
Use client side image map
wstring border
Link border width
long vSpace
Vertical gutter
long hSpace
Horizontal gutter
wstring alt
Short description
wstring src
Source URL
wstring align
Image alignment
long width
Override width
long height
Override height

Font Element

Local change to font

Properties

wstring color
Font color
wstring face
Font face
long size
Font size

INS, DEL Elements

Inserted or deleted text

Properties

wstring cite
Reason for change
wstring dateTime
Date and time of change

Object Element

Generic embedded object

Note: In principle, all properties on the object element are read-write but in some environments some properties may be read-only once the underlying object is instantiated.

Properties

wstring classId
Identifies an implementation
wstring align
Vertical or horizontal alignment
wstring name
Submit as part of form
wstring codeBase
Base URL for classid, data, archive
wstring codeType
Content type for code
wstring code
Code file
wstring type
Content type for data
long width
Initial width
long height
Initial height
wstring altHtml
long vSpace
Vertical gutter
long hSpace
Horizontal gutter
long tabIndex
Position in tab order

Methods

wstring getData();
HTMLFormElement getForm();
Return form containing this control

Q, BLOCKQUOTE ELEMENTS

Quoted text

Properties

wstring cite
URL for source document or message

Script Element

Script statements

Properties

wstring src
URL of external script
wstring text
wstring type
Content type of script language
wstring language
Predefined script language name

List Elements

UL, OL Elements

Unordered list and ordered list.

Properties

boolean compact
Reduce inter-item spacing.
wstring type
Bullet style
long start
Starting sequence number (for OL)

LI Element

List item

Properties

wstring type
List item style
long value
Reset sequence number

DL, DIR, MENU Elements

Definition list, directory list, menu list

Properties

boolean compact
Reduce inter-item spacing

DIV Element

Generic container

Properties

wstring align
Text alignment

HR Element

Horizontal rule

Properties

wstring align
Text alignment
boolean noShade
long width
Width of rule
long size

P Element

Paragraph

wstring align
Text alignment

H1, H2, H3, H4, H5, H6 Elements

Headings

Properties

wstring align
Text alignment

Image Maps

MAP Element

Client side image map

Properties

wstring name
Name, for reference by usemap

Methods

NamedNodeList getAreas();
Return a list of the areas in the map

Area Element

Client side image map area

Properties

wstring shape
Controls interpretation of coordinates
wstring coords
Comma-separated list of lengths
wstring href
URL for linked resource
wstring target
wstring alt
Short description
boolean noHref
This region has no action
long tabIndex
Position in tab order

Table Elements

CAPTION Element

Table Caption

Properties

wstring align
Text alignment

TABLE Element

The create* and delete* methods on the table provide easy access to construct and modify tables. HTML 4.0 defines that only 1 CAPTION, THEAD and TFOOT can exist in a table. If one exists, and the createTHead() or createTFoot() method is called, the method returns the THead or TFoot element that already exists.

Properties

long cols
Number of columns
wstring border
Border width
wstring frame
Which parts of table frame to include
wstring rules
Rulings between rows and cols
long cellSpacing
Spacing between cells
long cellPadding
Spacing within cells
wstring bgColor
Background color for cells
wstring align
Position of the table with respect to the document
long width
The desired width of the table

Methods

NamedNodeList getRows();
Get all row elements
HTMLTableSection getTHead();
Select the table head
HTMLTableSection getTFoot();
Select the table footer
NamedNodeList getBodies();
HTMLTableCaption getCaption();
Get the table caption
HTMLElement createTHead();
void deleteTHead();
Delete the table header
HTMLElement createTFoot();
Create a table footer
void deleteTFoot();
Delete the table footer
HTMLTableCaption createCaption();
Create a caption
void deleteCaption();
Delete the caption
HTMLElement insertRow(in long index);
Insert a new blank row
void deleteRow(in long index);
Delete a row

COLGROUP Element

Properties

long span
Used to delimit column groups
wstring hAlign
Horizontal alignment in cells
wstring vAlign
Vertical alignment in cells
long width
Default width

THEAD, TBODY, TFOOT Elements

Properties

wstring hAlign
Horizontal alignment in cells
wstring vAlign
Vertical alignment in cells

Methods

NamedNodeList getrows()
HTMLElement insertRow(in long index);
void deleteRow(in long index);

TR Element

The rowIndex returns the index relative to the entire table, and sectionRowIndex returns the index relative to the section the element is scoped within (THead, TFoot, or TBody)

Properties

wstring hAlign
Horizontal alignment in cells
wstring vAlign
Vertical alignment in cells
wstring bgColor
Background color for rows

Methods

long getRowIndex();
long getSectionRowIndex();
NamedNodeList getCells();
HTMLElement insertCell(in long index);
void deleteCell(in long index);

TH, TD Element

Properties

abbr
Abbreviation for header cells
axis
Names group of related headers
headers
List of ids for header cells
scope
Scope covered by header cells
long rowSpan
Number of rows spanned by cell
long colSpan
Number of columns spanned by cell
wstring hAlign
Horizontal alignment in cells
wstring vAlign
Vertical alignment in cells
wstring bgColor
Cell background color
boolean noWrap
Suppress word wrap
long width
Width for cell
long height
Height for cell

Methods

long getCellIndex();

Comment Element

Properties

wstring text
Comment text

Frame and related Elements

Ways of defining the frames in an HTML document.

FRAMESET Element

Properties

wstring rows
List of lengths (default 100%, 1 row)
wstring cols
List of columns (default 100%, 1 col)

FRAME Element

Subwindow

Properties

wstring src
Source URL
wstring name
Name of frame, for targetting
boolean noResize
Forbid user from resizing frame?
wstring scrolling
Scrollbar or none
wstring frameBorder
Request frame borders?
long marginWidth
Margin width in pixels
long marginHeight
Margin height in pixels

IFRAME Element

Inline subwindows

Properties

wstring src
Source URL
wstring name
Name, for targetting
wstring scrolling
Scrollbar or none
wstring align
Vertical or horizontal alignment
long marginWidth;
Margin width in pixels
long marginHeight;
Margin height in pixels
long width
Frame width
long height
Frame height

Appendix A: HTML IDL Interface definitions

This contains the complete IDL definitions for the HTML support provided by the Document Object Model.

//hb////-*-Mode: C++-*-////////////////////////////////////////////////////////
//                                                                           //
// NAME        :                                                             //
// DESCRIPTION :                                                             //
// HISTORY     :                                                             //
//                                                                           //
//he///////////////////////////////////////////////////////////////////////////

interface HTMLStyle {
  // Hook for later level
};

interface NamedNodeList : NodeList {
  // Same interface, different semantics
};

interface HTMLDocument : Document
{
  // These are all methods, because they do some processing
  // of the document
  NamedNodeList  getImages();
  NamedNodeList  getApplets();
  NamedNodeList  getLinks();
  NamedNodeList  getForms();
  NamedNodeList  getAnchors();
  NamedNodeList  getScripts();

  // These are methods because we have not defined a list
  // of cookies anywhere in the model
  wstring         getCookie();
  wstring         setCookie(in wstring cookie);

  readonly attribute wstring       referrer;
  readonly attribute wstring       fileSize;
  readonly attribute wstring       fileCreatedDate;
  readonly attribute wstring       fileModifiedDate;
  readonly attribute wstring       fileUpdatedDate;
  readonly attribute HTMLLocation  location;

  attribute HTMLElement body;
};

interface HTMLLocation
{
  attribute wstring  href;

  attribute wstring  protocol;
  attribute wstring  host;
  attribute wstring  hostname;
  attribute wstring  port;
  attribute wstring  pathname;
  attribute wstring  query;
  attribute wstring  fragment;

  void     reload(in boolean flag);
  void     replace(in wstring url);
};

interface HTMLElement : Element
{
  attribute wstring         tagName;
  attribute wstring         className;
  attribute wstring         id;
  attribute HTMLStyle       style;
  attribute HTMLElement     parentElement;
  attribute wstring         title;
  attribute wstring         lang;
  attribute wstring         dir;
  attribute wstring         onClick;
  attribute wstring         onDblClick;
  attribute wstring         onKeyDown;
  attribute wstring         onKeyUp;
  attribute wstring         onKeypress;
  attribute wstring         onMouseOut;
  attribute wstring         onMouseOver;
  attribute wstring         onMouseMove;
  attribute wstring         onMouseUp;
  attribute wstring         onMouseDown;

  attribute NamedNodeList  all;

  readonly attribute HTMLDocument document;

  boolean contains(in HTMLElement pChild);

  void     addAttribute(in wstring name, in Object value, in long lFlags);
  Object   getAttribute(in wstring name,in long lFlags);
  boolean  removeAttribute(in wstring name, in long lFlags);
};

interface HTMLLinkElement : HTMLElement
{
  attribute wstring href;
  attribute wstring rel;
  attribute wstring rev;
  attribute wstring type;
  attribute wstring media;

  wstring getReadyState();
};

interface HTMLTitleElement : HTMLElement
{
  attribute wstring text;
};

interface HTMLMetaElement : HTMLElement
{
  // Can't you have a number of these?
  attribute wstring httpEquiv;

  attribute wstring content;
  attribute wstring name;
  attribute wstring text;
  attribute wstring url;
  attribute wstring charset;
};

interface HTMLBaseElement : HTMLElement
{
  attribute wstring href;
  attribute wstring target;
};

interface HTMLIsIndexElement : HTMLElement
{
  attribute wstring  prompt;
  attribute wstring  action;
};

interface HTMLStyleElement : HTMLElement
{
  attribute wstring type;
  attribute boolean disabled;
  attribute wstring media;
};

interface HTMLBodyElement : HTMLElement
{
  attribute wstring background;
  attribute wstring bgColor;
  attribute wstring text;
  attribute wstring link;
  attribute wstring vlink;
  attribute wstring alink;
};

interface HTMLFormElement : HTMLElement
{
  attribute wstring action;
  attribute wstring method;
  attribute wstring target;
  attribute wstring name;
  attribute long    length;

  attribute HTMLFormElement elements;
  
  // Note the use of Object here!!!!
  HTMLElement    getItem(in Object name, in Object index);
  
  NamedNodeList getTags(in wstring name);
};

interface HTMLSelectElement : HTMLElement
{
  attribute long     selectedIndex;
  attribute long     size;
  attribute boolean  multiple;
  attribute wstring  name;
  attribute wstring  type;
  attribute wstring  value;
  attribute boolean  disabled;
  attribute long     length;

  readonly attribute HTMLFormElement  form;
  attribute NamedNodeList            options;

  void add(in HTMLElement element, in HTMLElement before);
  void remove(in long index);

  HTMLElement       getItem(in wstring name);
  NamedNodeList    getTags(in wstring tagname);
};

interface HTMLOptionElement : HTMLElement
{
  attribute wstring         text;
  attribute long            index;
  attribute boolean         selected;
  attribute wstring         value;
  attribute boolean         defaultSelected;

  readonly attribute HTMLFormElement form;
};

interface HTMLFieldSetElement : HTMLElement
{
  attribute wstring align;
};

interface HTMLLegendElement : HTMLElement
{
  attribute wstring align;
};

interface HTMLInputTextElement : HTMLElement
{
  attribute wstring  value;
  attribute wstring  name;
  attribute boolean  disabled;
  attribute wstring  defaultValue;
  attribute long     size;
  attribute long     maxLength;
  attribute boolean  readOnly;
  attribute boolean  checked;
  attribute boolean  defaultChecked;

  readonly attribute HTMLFormElement form;
};

interface HTMLTextAreaElement : HTMLElement
{
  attribute wstring  type;
  attribute wstring  value;
  attribute wstring  name;
  attribute boolean  disabled;
  attribute wstring  defaultValue;
  attribute boolean  readOnly;
  attribute long     rows;
  attribute long     cols;
  attribute wstring  wrap;

  readonly attribute HTMLFormElement form;
};

interface HTMLButtonElement : HTMLElement
{
  attribute wstring  type;
  attribute wstring  value;
  attribute wstring  name;
  attribute boolean  disabled;

  readonly attribute HTMLFormElement form;
};


interface HTMLLabelElement : HTMLElement
{
  attribute wstring htmlFor;
  attribute wstring accessKey;
};

interface HTMLAnchorElement : HTMLElement
{
  attribute wstring target;
  attribute wstring href;
  attribute wstring rel;
  attribute wstring rev;
  attribute wstring name;
  attribute wstring accessKey;
  attribute long    tabIndex;
  attribute wstring charset;
};

interface HTMLBaseFontElement : HTMLElement
{
  attribute wstring color;
  attribute wstring face;
  attribute long    size;
};

interface HTMLBRElement : HTMLElement
{
  attribute wstring clear;
};

interface HTMLImgElement : HTMLElement
{
  attribute boolean  isMap;
  attribute wstring  useMap;
  attribute wstring  border;
  attribute long     vspace;
  attribute long     hspace;
  attribute wstring  alt;
  attribute wstring  src;
  attribute wstring  lowSrc;
  attribute wstring  align;
  attribute long     width;
  attribute long     height;
};

interface HTMLFontElement : HTMLElement
{
  attribute wstring color;
  attribute wstring face;
  attribute long    size;
};

interface HTMLModElement : HTMLElement
{
  attribute wstring cite;
  attribute wstring dateTime;
};

interface HTMLObjectElement : HTMLElement
{
  // Note the use of Object here!!!!
  attribute Object object;

  attribute wstring   classId;
  attribute wstring   data;
  attribute wstring   align;
  attribute wstring   name;
  attribute wstring   codeBase;
  attribute wstring   codeType;
  attribute wstring   code;    // This is almost certainly wrong
  attribute wstring   type;
  attribute long      width;
  attribute long      height;
  attribute wstring   altHtml;
  attribute long      vspace;
  attribute long      hspace;
  attribute long      tabIndex;

  readonly attribute HTMLFormElement form;
};

interface HTMLQuoteElement : HTMLElement
{
  attribute wstring cite;
};

interface HTMLScriptElement : HTMLElement
{
  attribute wstring  src;
  attribute wstring  text;
  attribute wstring  type;
  attribute wstring  language;
};

interface HTMLUListElement : HTMLElement
{
  attribute boolean compact;
  attribute wstring type;
};

interface HTMLOListElement : HTMLElement
{
  attribute boolean compact;
  attribute wstring type;
  attribute long    start;
};

interface HTMLLIElement : HTMLElement
{
  attribute wstring type;
  attribute long    value;
};

interface HTMLDListElement : HTMLElement { 
  attribute boolean compact;
};

interface HTMLDivElement : HTMLElement
{
  attribute wstring align;
};

interface HTMLHRElement : HTMLElement
{
  attribute wstring  align;
  attribute boolean  noShade;
  attribute long     width;
  attribute long     size;
};

interface HTMLParaElement : HTMLElement
{
  attribute wstring align;
};

interface HTMLHeaderElement : HTMLElement
{
  attribute wstring align;
};

interface HTMLMapElement : HTMLElement
{
  NamedNodeList getAreas();

  attribute wstring name;
};

interface HTMLAreaElement : HTMLElement
{
  attribute wstring  shape;
  attribute wstring  coords;
  attribute wstring  href;
  attribute wstring  target;
  attribute wstring  alt;
  attribute boolean  noHref;
  attribute long     tabIndex;
};

interface HTMLTableCaption : HTMLElement
{
  attribute wstring align;
};

interface HTMLTable : HTMLElement
{
  attribute long               cols;
  attribute wstring            border;
  attribute wstring            frame;
  attribute wstring            rules;
  attribute long               cellSpacing;
  attribute long               cellPadding;
  attribute wstring            bgColor;
  attribute wstring            align;
  attribute long               width;
  attribute HTMLTableCaption   caption;
  attribute HTMLTableSection   head;
  attribute HTMLTableSection   tfoot;


  NamedNodeList     getRows();
  NamedNodeList     getBodies();

  HTMLElement        createTHead();
  void               deleteTHead();

  HTMLElement        createTFoot();
  void               deleteTFoot();

  HTMLTableCaption   createCaption();
  void               deleteCaption();

  HTMLElement        insertRow(in long index);
  void               deleteRow(in long index);
};

interface HTMLTableCol : HTMLElement
{
  attribute long     span;
  attribute wstring  align;
  attribute wstring  valign;
  attribute long     width;
};

interface HTMLTableSection : HTMLElement
{
  NamedNodeList getRows();

  HTMLElement insertRow(in long index);
  void        deleteRow(in long index);
  
  attribute wstring align;
  attribute wstring valign;
};

interface HTMLTableRow : HTMLElement
{
  attribute long     rowIndex;
  attribute long     sectionRowIndex;
  attribute wstring  align;
  attribute wstring  valign;
  attribute wstring  bgColor;

  NamedNodeList getCells();

  HTMLElement insertCell(in long index);
  void        deleteCell(in long index);
};

interface HTMLTableCell : HTMLElement
{
  attribute long     cellIndex;
  attribute long     rowSpan;
  attribute long     colSpan;
  attribute wstring  align;
  attribute wstring  valign;
  attribute wstring  bgColor;
  attribute boolean  noWrap;
  attribute long     width;
  attribute long     height;
};

interface HTMLCommentElement : HTMLElement
{
  attribute wstring text;
};

interface HTMLFrameSetElement : HTMLElement
{
  attribute wstring rows;
  attribute wstring cols;
};

interface HTMLFrameElement : HTMLElement
{
  attribute wstring  src;
  attribute wstring  name;
  attribute boolean  noResize;
  attribute wstring  scrolling;
  attribute wstring  frameBorder;
  attribute long     marginWidth;
  attribute long     marginHeight;
};

interface HTMLIFrameElement : HTMLElement 
{
  attribute wstring  src;
  attribute wstring  name;
  attribute wstring  scrolling;
  attribute wstring  align;
  attribute long     marginWidth;
  attribute long     marginHeight;
  attribute long     width;
  attribute long     height;
};

Appendix B: Java HTML API definitions

public interface HTMLStyle {
  // Hook for level two
};

public interface NamedNodeList extends NodeList {

  Node namedItem(String name);

};

public interface HTMLDocument extends Document {

  NamedNodeList  getImages();
  NamedNodeList  getApplets();
  NamedNodeList  getLinks();
  NamedNodeList  getForms();
  NamedNodeList  getAnchors();
  NamedNodeList  getScripts();

  String         getCookie();
  String         setCookie(String cookie);

  String getReferrer();
  String getFileSize();
  String getFileCreatedDate();
  String getFileModifiedDate();
  String getFileUpdatedDate();
  HTMLLocation getLocation();

  void setBody(HTMLElement body);

  HTMLElement getBody();

};

public interface HTMLLocation {

  void setHref(String href);
  String getHref();

  void setProtocol(String protocol);
  String getProtocol();

  void setHost(String host);
  String getHost();

  void setHostname(String hostname);
  String getHostname();

  void setPort(String port);
  String getPort();

  void setPathname(String pathname);
  String getPathname();

  void setQuery(String query);
  String getQuery();

  void setFragment(String fragment);
  String getFragment();

  void reload(boolean flag);
  void replace(String url);

};


public interface HTMLElement extends Element {

  void setTagName(String tagName);
  String getTagName();

  void setClassName(String className);
  String getClassName();

  void setId(String id);
  String getId();

  void setStyle(HTMLStyle style);
  HTMLStyle getStyle();

  void setParentElement(HTMLElement parentElement);
  HTMLElement getParentElement();

  void setTitle(String title);
  String getTitle();

  void setLang(String lang);
  String getLang();

  void setDir(String dir);
  String getDir();

  void setAll(NamedNodeList all);
  NamedNodeList getAll();

  HTMLDocument getDocument();

  boolean contains(HTMLElement pChild);

  void     addAttribute(String name, Object value, long lFlags);
  Object   getAttribute(String name, long lFlags);
  boolean  removeAttribute(String name, long lFlags);

};

public interface HTMLLinkElement extends HTMLElement {

  void setHref(String href);
  String getHref();

  void setRel(String rel);
  String getRel();

  void setRev(String rev);
  String getRev();

  void setType(String type);
  String getType();

  void setMedia(String media);
  String getMedia();

  String getReadyState();

};


public interface HTMLTitleElement extends HTMLElement {

  void setText(String text);
  String getText();

};


public interface HTMLMetaElement extends HTMLElement {

  void setHttpEquiv(String httpEquiv);
  String getHttpEquiv();

  void setContent(String content);
  String getContent();

  void setName(String name);
  String getName();

  void setText(String text);
  String getText();

  void setUrl(String url);
  String getUrl();

  void setCharset(String charset);
  String getCharset();

};


public interface HTMLBaseElement extends HTMLElement {

  void setHref(String href);
  String getHref();

  void setTarget(String target);
  String getTarget();

};


public interface HTMLIsIndexElement extends HTMLElement {

  void setPrompt(String prompt);
  String getPrompt();

  void setAction(String action);
  String getAction();

};


public interface HTMLStyleElement extends HTMLElement {

  void setType(String type);
  String getType();

  void setDisabled(boolean disabled);
  boolean getDisabled();

  void setMedia(String media);
  String getMedia();

};


public interface HTMLBodyElement extends HTMLElement {

  void setBackground(String background);
  String getBackground();

  void setBgColor(String bgColor);
  String getBgColor();

  void setText(String text);
  String getText();

  void setLink(String link);
  String getLink();

  void setVlink(String vlink);
  String getVlink();

  void setAlink(String alink);
  String getAlink();

};


public interface HTMLFormElement extends HTMLElement {

  void setAction(String action);
  String getAction();

  void setMethod(String method);
  String getMethod();

  void setTarget(String target);
  String getTarget();

  void setName(String name);
  String getName();

  void setLength(long length);
  long getLength();

  void setElements(HTMLFormElement elements);
  HTMLFormElement getElements();

  HTMLElement    getItem(Object name,Object index);
  
  NamedNodeList getTags(String name);

};


public interface HTMLSelectElement extends HTMLElement {

  void setSelectedIndex(long selectedIndex);
  long getSelectedIndex();

  void setSize(long size);
  long getSize();

  void setMultiple(boolean multiple);
  boolean getMultiple();

  void setName(String name);
  String getName();

  void setType(String type);
  String getType();

  void setValue(String value);
  String getValue();

  void setDisabled(boolean disabled);
  boolean getDisabled();

  void setLength(long length);
  long getLength();

  HTMLFormElement getForm();
  void setOptions(NamedNodeList options);
  NamedNodeList getOptions();

  void add(HTMLElement element,HTMLElement before);
  void remove(long index);

  HTMLElement       getItem(String name);
  NamedNodeList    getTags(String tagname);

};


public interface HTMLOptionElement extends HTMLElement {

  void setText(String text);
  String getText();

  void setIndex(long index);
  long getIndex();

  void setSelected(boolean selected);
  boolean getSelected();

  void setValue(String value);
  String getValue();

  void setDefaultSelected(boolean defaultSelected);
  boolean getDefaultSelected();

  HTMLFormElement getForm();

};


public interface HTMLFieldSetElement extends HTMLElement {

  void setAlign(String align);
  String getAlign();

};


public interface HTMLLegendElement extends HTMLElement {

  void setAlign(String align);
  String getAlign();

};

public interface HTMLInputTextElement extends HTMLElement {

  void setValue(String value);
  String getValue();

  void setName(String name);
  String getName();

  void setDisabled(boolean disabled);
  boolean getDisabled();

  void setDefaultValue(String defaultValue);
  String getDefaultValue();

  void setSize(long size);
  long getSize();

  void setMaxLength(long maxLength);
  long getMaxLength();

  void setReadOnly(boolean readOnly);
  boolean getReadOnly();

  void setChecked(boolean checked);
  boolean getChecked();

  void setDefaultChecked(boolean defaultChecked);
  boolean getDefaultChecked();

  HTMLFormElement getForm();

};


public interface HTMLTextAreaElement extends HTMLElement {

  void setType(String type);
  String getType();

  void setValue(String value);
  String getValue();

  void setName(String name);
  String getName();

  void setDisabled(boolean disabled);
  boolean getDisabled();

  void setDefaultValue(String defaultValue);
  String getDefaultValue();

  void setReadOnly(boolean readOnly);
  boolean getReadOnly();

  void setRows(long rows);
  long getRows();

  void setCols(long cols);
  long getCols();

  void setWrap(String wrap);
  String getWrap();

  HTMLFormElement getForm();

};


public interface HTMLButtonElement extends HTMLElement {

  void setType(String type);
  String getType();

  void setValue(String value);
  String getValue();

  void setName(String name);
  String getName();

  void setDisabled(boolean disabled);
  boolean getDisabled();

  HTMLFormElement getForm();

};


public interface HTMLLabelElement extends HTMLElement {

  void setHtmlFor(String htmlFor);
  String getHtmlFor();

  void setAccessKey(String accessKey);
  String getAccessKey();

};


public interface HTMLAnchorElement extends HTMLElement {

  void setTarget(String target);
  String getTarget();

  void setHref(String href);
  String getHref();

  void setRel(String rel);
  String getRel();

  void setRev(String rev);
  String getRev();

  void setName(String name);
  String getName();

  void setAccessKey(String accessKey);
  String getAccessKey();

  void setTabIndex(long tabIndex);
  long getTabIndex();

  void setCharset(String charset);
  String getCharset();

};


public interface HTMLBaseFontElement extends HTMLElement {

  void setColor(String color);
  String getColor();

  void setFace(String face);
  String getFace();

  void setSize(long size);
  long getSize();

};


public interface HTMLBRElement extends HTMLElement {

  void setClear(String clear);
  String getClear();

};


public interface HTMLImgElement extends HTMLElement {

  void setIsMap(boolean isMap);
  boolean getIsMap();

  void setUseMap(String useMap);
  String getUseMap();

  void setBorder(String border);
  String getBorder();

  void setVspace(long vspace);
  long getVspace();

  void setHspace(long hspace);
  long getHspace();

  void setAlt(String alt);
  String getAlt();

  void setSrc(String src);
  String getSrc();

  void setLowSrc(String lowSrc);
  String getLowSrc();

  void setAlign(String align);
  String getAlign();

  void setWidth(long width);
  long getWidth();

  void setHeight(long height);
  long getHeight();

};


public interface HTMLFontElement extends HTMLElement {

  void setColor(String color);
  String getColor();

  void setFace(String face);
  String getFace();

  void setSize(long size);
  long getSize();

};


public interface HTMLModElement extends HTMLElement {

  void setCite(String cite);
  String getCite();

  void setDateTime(String dateTime);
  String getDateTime();

};


public interface HTMLObjectElement extends HTMLElement {

  void setObject(Object object);
  Object getObject();

  void setClassId(String classId);
  String getClassId();

  void setData(String data);
  String getData();

  void setAlign(String align);
  String getAlign();

  void setName(String name);
  String getName();

  void setCodeBase(String codeBase);
  String getCodeBase();

  void setCodeType(String codeType);
  String getCodeType();

  void setCode(String code);
  String getCode();

  void setType(String type);
  String getType();

  void setWidth(long width);
  long getWidth();

  void setHeight(long height);
  long getHeight();

  void setAltHtml(String altHtml);
  String getAltHtml();

  void setVspace(long vspace);
  long getVspace();

  void setHspace(long hspace);
  long getHspace();

  void setTabIndex(long tabIndex);
  long getTabIndex();

  HTMLFormElement getForm();

};


public interface HTMLQuoteElement extends HTMLElement {

  void setCite(String cite);
  String getCite();

};


public interface HTMLScriptElement extends HTMLElement {

  void setSrc(String src);
  String getSrc();

  void setText(String text);
  String getText();

  void setType(String type);
  String getType();

  void setLanguage(String language);
  String getLanguage();

};


public interface HTMLUListElement extends HTMLElement {

  void setCompact(boolean compact);
  boolean getCompact();

  void setType(String type);
  String getType();

};


public interface HTMLOListElement extends HTMLElement {

  void setCompact(boolean compact);
  boolean getCompact();

  void setType(String type);
  String getType();

  void setStart(long start);
  long getStart();

};


public interface HTMLLIElement extends HTMLElement {

  void setType(String type);
  String getType();

  void setValue(long value);
  long getValue();

};


public interface HTMLDListElement extends HTMLElement { 

  void setCompact(boolean compact);
  boolean getCompact();

};


public interface HTMLDivElement extends HTMLElement {

  void setAlign(String align);
  String getAlign();

};


public interface HTMLHRElement extends HTMLElement {

  void setAlign(String align);
  String getAlign();

  void setNoShade(boolean noShade);
  boolean getNoShade();

  void setWidth(long width);
  long getWidth();

  void setSize(long size);
  long getSize();

};


public interface HTMLParaElement extends HTMLElement {

  void setAlign(String align);
  String getAlign();

};


public interface HTMLHeaderElement extends HTMLElement {

  void setAlign(String align);
  String getAlign();

};


public interface HTMLMapElement extends HTMLElement {

  NamedNodeList getAreas();

  void setName(String name);
  String getName();

};


public interface HTMLAreaElement extends HTMLElement {

  void setShape(String shape);
  String getShape();

  void setCoords(String coords);
  String getCoords();

  void setHref(String href);
  String getHref();

  void setTarget(String target);
  String getTarget();

  void setAlt(String alt);
  String getAlt();

  void setNoHref(boolean noHref);
  boolean getNoHref();

  void setTabIndex(long tabIndex);
  long getTabIndex();

};


public interface HTMLTableCaption extends HTMLElement {

  void setAlign(String align);
  String getAlign();

};


public interface HTMLTable extends HTMLElement {

  void setCols(long cols);
  long getCols();

  void setBorder(String border);
  String getBorder();

  void setFrame(String frame);
  String getFrame();

  void setRules(String rules);
  String getRules();

  void setCellSpacing(long cellSpacing);
  long getCellSpacing();

  void setCellPadding(long cellPadding);
  long getCellPadding();

  void setBgColor(String bgColor);
  String getBgColor();

  void setAlign(String align);
  String getAlign();

  void setWidth(long width);
  long getWidth();

  void setCaption(HTMLTableCaption caption);
  HTMLTableCaption getCaption();

  void setHead(HTMLTableSection head);
  HTMLTableSection getHead();

  void setTfoot(HTMLTableSection tfoot);
  HTMLTableSection getTfoot();

  NamedNodeList     getRows();
  NamedNodeList     getBodies();

  HTMLElement        createTHead();
  void               deleteTHead();

  HTMLElement        createTFoot();
  void               deleteTFoot();

  HTMLTableCaption   createCaption();
  void               deleteCaption();

  HTMLElement        insertRow(long index);
  void               deleteRow(long index);

};


public interface HTMLTableCol extends HTMLElement {

  void setSpan(long span);
  long getSpan();

  void setAlign(String align);
  String getAlign();

  void setValign(String valign);
  String getValign();

  void setWidth(long width);
  long getWidth();

};


public interface HTMLTableSection extends HTMLElement {

  NamedNodeList getRows();

  HTMLElement insertRow(long index);
  void        deleteRow(long index);
  
  void setAlign(String align);
  String getAlign();

  void setValign(String valign);
  String getValign();

};


public interface HTMLTableRow extends HTMLElement {

  void setRowIndex(long rowIndex);
  long getRowIndex();

  void setSectionRowIndex(long sectionRowIndex);
  long getSectionRowIndex();

  void setAlign(String align);
  String getAlign();

  void setValign(String valign);
  String getValign();

  void setBgColor(String bgColor);
  String getBgColor();

  NamedNodeList getCells();

  HTMLElement insertCell(long index);
  void        deleteCell(long index);

};


public interface HTMLTableCell extends HTMLElement {

  void setCellIndex(long cellIndex);
  long getCellIndex();

  void setRowSpan(long rowSpan);
  long getRowSpan();

  void setColSpan(long colSpan);
  long getColSpan();

  void setAlign(String align);
  String getAlign();

  void setValign(String valign);
  String getValign();

  void setBgColor(String bgColor);
  String getBgColor();

  void setNoWrap(boolean noWrap);
  boolean getNoWrap();

  void setWidth(long width);
  long getWidth();

  void setHeight(long height);
  long getHeight();

};


public interface HTMLCommentElement extends HTMLElement {

  void setText(String text);
  String getText();

};


public interface HTMLFrameSetElement extends HTMLElement {

  void setRows(String rows);
  String getRows();

  void setCols(String cols);
  String getCols();

};


public interface HTMLFrameElement extends HTMLElement {

  void setSrc(String src);
  String getSrc();

  void setName(String name);
  String getName();

  void setNoResize(boolean noResize);
  boolean getNoResize();

  void setScrolling(String scrolling);
  String getScrolling();

  void setFrameBorder(String frameBorder);
  String getFrameBorder();

  void setMarginWidth(long marginWidth);
  long getMarginWidth();

  void setMarginHeight(long marginHeight);
  long getMarginHeight();

};


public interface HTMLIFrameElement extends HTMLElement {

  void setSrc(String src);
  String getSrc();

  void setName(String name);
  String getName();

  void setScrolling(String scrolling);
  String getScrolling();

  void setAlign(String align);
  String getAlign();

  void setMarginWidth(long marginWidth);
  long getMarginWidth();

  void setMarginHeight(long marginHeight);
  long getMarginHeight();

  void setWidth(long width);
  long getWidth();

  void setHeight(long height);
  long getHeight();

};

Appendix C: ECMAScript HTML API definitions


This will contain the ECMAScript bindings for the HTML DOM.


Appendix D: Glossary

There are a large number of terms that the DOM uses which may not be familiar to many of the readers. We suggest that you review the glossary if you encounter terms that aren't familiar.