W3C

Window Object 1.0

W3C Editor's Draft 01 May 2006

This version:
http://dev.w3.org/cvsweb/~checkout~/2006/webapi/Window/publish/Window.html
Latest version:
http://dev.w3.org/cvsweb/~checkout~/2006/webapi/Window/publish/Window.html
Editors:
Ian Davis (Talis Information Ltd.) <ian.davis@talis.com>
Maciej Stachowiak (Apple Computer, Inc.) <mjs@apple.com>

Abstract

This specification defines the Window object, which provides the global namespace for web scripting languages, access to other documents in a compound document by reference, navigation to other locations, and timers. The Window object is a longstanding de facto standard for HTML user agents. However, it should not be assumed based on this or the name "Window" that it is limited to HTML or to visual user agents.

Status of this Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

This document is produced by the Web API WG (part of the Rich Web Clients Activity). This document has no formal standing within the W3C. Please send comments to public-webapi@w3.org, the public email list for issues related to Web APIs.

The patent policy for this document is the 5 February 2004 W3C Patent Policy. Patent disclosures relevant to this specification may be found on the Web API Working Group's patent disclosure page. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) with respect to this specification should disclose the information in accordance with section 6 of the W3C Patent Policy.

Publication as an Editor's Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.

Table of contents

1. Introduction

This section is not normative.

The Window Object 1.0 specification defines a subset of the features of the Window object, a widely implemented part of HTML User Agents, with parts also found in non-HTML UAs that offer scripting and DOM access. This specification is intended to be suitable for all implementations that present any sort of DOM document [DOM3Core] to the user.

This specification defines four features of the window object. It describes the use of the Window object as a browsing context: a container that displays a document, or a series of documents in sequence. It describes interfaces for navigation, the ability to go to a new document in the same browsing context. It describes interfaces for embedding, a feature also known as compound document by reference, where one document includes another separate document by external reference. And it specifies methods for using timers.

In addition, for some languages, such as ECMAScript [ECMAScript], the Window interface is implemented by the object that provides the global namespace for script execution. The details of how this works for ECMAScript are specified in ECMAScript Language Binding Appendix.

1.1. Examples of usage

This section is not normative.

ACTION-129: Write Window Object 1.0 "examples of usage" section.

1.2. Not in This Specification

This section is not normative.

This specification does not include the following features, which are also found on the Window object in some implementations. It is possible they will defined by other specifications or found in a future version of this specification.

1.3. Definitions

This section is not normative.

This specification distinctively marks terms being defined, and references to definitions. Uses of terms are hyperlinks to the point of definition. An example of a definition:

A flux capacitor is the part of user agents that has the most negative imaginary flux impedance.

An example of use:

When the engines are damaged, user agents typically calibrate the flux capacitor.

1.4. Conformance

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [RFC2119].

Sometimes, for readability, conformance requirements are phrased as requirements on elements, attributes, methods, interfaces, properties or functions. In all cases these are conformance requirements on implementations.

This specification defines three classes of conformance:

conforming implementation
A conforming implementation of the Window Object 1.0 specification is one that implements all the interfaces in this specification, and satisfies all other MUST-, REQUIRED- and SHALL-level criteria in all parts of this document other than language binding appendices.
conforming ECMAScript implementation
A conforming ECMAScript implementation of the Window Object 1.0 specification is a conforming implementation that maps all of the interfaces in this specification to ECMAScript [ECMAScript], and satisfies the additional requirements in the ECMAScript Language Binding Appendix.
conforming Java implementation
A conforming Java implementation of the Window Object 1.0 specification is a conforming implementation that maps all of the interfaces in this specification to Java [Java], and satisfies the additional requirements in the Java Language Binding Appendix.

2. Browsing Contexts

A browsing context is a collection of one or more views that present a Document or a sequence of Documents to the user, using one or more views. Only one Document of this sequence is presented at a time. A browsing context is said to navigate when it changes from presenting one document to another or one fragment within the same document to another, for example by following a hyperlink. More is specified about navigation behavior in the Navigation section.

The most familiar example of a browsing context is a web browser window. Browsers, or more generally visual user agents, typically present a document by rendering it to a display. However, even non-visual agents could have a browsing context. For example, a voice browser also presents documents to the user. This also establishes a browsing context.

For purposes of this specification, a Document is an object that implements the DOM Document interface [DOM3Core]. A Document that is presented in a browsing context MUST also implement the DocumentWindow interface.

The main view of Document presented in a browsing context is distinguished as the default view. The default view is typically the primary mode of presentation to the user, and in interactive user agents, the primary means of interaction for the user. The default view MUST be represented by an object that implements the Window interface.

An object that implements the Window interface is referred to as a Window object. Note: despite the name, a Window object does not necessarily represent an onscreen overlapping window, even in visual user agents.

A document presented in a browsing context may have elements that embed additional documents, forming a Compound Document by Reference. Each such element creates a nested browsing context. This mechanism is described in Embedding: Compound Documents by Reference.

2.1. The Window Interface, Basic Attributes

The Window interface is fully specified in IDL in the IDL Definitions Appendix. To better organize this specification, it is described in prose in multiple IDL fragments.

The Window interface inherits from the AbstractView interface [DOM2Views].

In implementations that support Document Object Model CSS from DOM Level 2 Views [DOM2Views], every Window object MUST also implement the ViewCSS interface.

In implementations that support DOM Events [DOM3EV], every Window object MUST also implement the EventTarget interface.


interface Window : views::AbstractView {
    // ...

    // self-references
    readonly attribute Window window;
    readonly attribute Window self;

    // ...
};

The value of the document property inherited by Window objects from the AbstractView interface MUST be the Document for which the Window is a view. As a result, in addition to the DocumentView interface, it implements the Document and DocumentWindow interfaces.

2.1.1. Attributes

Window objects MUST have the following attributes:

window attribute
The value of the window attribute MUST be the same Window object that has the attribute: the attribute is a self-reference.
self attribute
The value of the self attribute MUST be the same Window object that has the attribute: the attribute is a self-reference. Consequently, the value of the self attribute MUST be the same object as the window attribute.
ACTION-131: Need to define "being the same object" in such a way that it is an equivalence relation. Then the second conformance clause for "self" can just be a note.

2.1.2. Use in scripting

The Window object also has a special role as the global scope for scripts in the document in languages such as ECMAScript [ECMAScript]. Such use is specified by individual language bindings. For ECMAScript it is specified in the ECMAScript Language Binding Appendix.

2.2. The DocumentWindow Interface, Basic Attributes

To better organize this specification, the DocumentWindow interface is presented in mulitple IDL fragments. The full normative IDL interface is presented in the IDL Definitions Appendix. This fragment defines only the most basic methods and attributes of the Window interface.


interface DocumentWindow : views::DocumentView {
    // ...
    Window parentWindow;
    // ...
};

The value of the defaultView attribute inherited by objects that implement the DocumentWindow interface from the AbstractView interface MUST be the default view for the browsing context presenting the Document, if any. If a document is not being presented in a browsing context but nonetheless implements the DocumentWindow interface, the value of the defaultView attribute MUST be null.

2.3. Attributes

Window objects MUST have the following attributes:

parentWindow
The value of the parentWindow attribute MUST be the default view for the browsing context presenting the Document, if any. If a document is not being presented in a browsing context but nonetheless implements the DocumentWindow interface, the value of the defaultView attribute MUST be null. Note: the defaultView and parentWindow attributes refer to the same object, but the former gives the AbstractView interface while the latter gives the Window interface.

3. Events

In implementations that support DOM Events [DOM3EV], Window objects provide the default view for their contained Documents. In such implementations, Window objects are also an event target and participate in the DOM event flow [DOM3EV].

When an event implementing the UIEvent interface [DOM3EV] that originates in the default view of a Document presented in a browsing context, the value of the view attribute of the event is be the Window object where the user originated the event. This is required by DOM Level 2 Views [DOM2Views].

As an extension to the DOM event flow [DOM3EV] for conforming implementations, the Window object is added to the DOM event flow. For all events that target the Document or any of its descendant DOM nodes, except "load" events in the null namespace, conforming implementations MUST do both of the following:

However, conforming implementations MUST NOT dispatch "load" events in the null namespace that target the Document or any of its descendant DOM nodes to the Window object, in either the capture or bubble phases. The reason for this exception is historical. This was not done in some implementations, leading to content that depends on "load" events on various DOM elements not triggering "load" event listeners on the Window object. For compatibility, this limitation is retained. Note: this does not affect "load" events that dispatch directly on the Window object.

A browsing context has a session history: a sequence of absolute URI references [RFC2396]. It also has a current history position, an integer index into the session history that identifies the absolute URI reference for the document currently being presented. The absolute URI reference at the current history position is called the current location. The session history models the back/forward system of navigation familiar to browser users.

When a browsing context changes from one current location to another, it is said to perform a navigation to a target location, as specified by an absolute URI reference.

A navigation can be triggered in many different situations. For example, a user action, such as typing a URI in a location field or selecting a bookmark MAY have this effect. Markup languages and APIs also specify particular situations that trigger a navigation, such as activating a hyperlink or submitting a form. This specification defines some API operations that result in a navigation, using the algorithms described below.

When a browsing context performs a navigation that is not specifically intended to be a history navigation, reload, or replacement, it MUST remove any entries in the session history after the current history position, append the target location, and update the current history position to point to it. These values MUST be updated at the moment the browsing context starts presenting the new document. In particular, they MUST NOT be updated while still presenting the last document (if different from the new one), and MUST be updated when presenting even a partially loaded portion of the new document.

When a navigation is performed to a target location that differs only in fragment identifier [RFC2396] from the current location, the browsing context MUST continue to present the same document, but MAY adjust its presentation of the document based on the fragment identifier. Individual markup languages SHOULD define the proper way to interpret fragment identifiers when displaying a document using that language.

The SHOULD above doesn't relate to a conformance class, should we describe how a language spec can be Window-compatible?

Conforming implementations MAY also offer user interfaces, APIs, markup language features or other mechanisms that result in a reload, replacement or history navigation, behaving as described below in the algorithms section or otherwise. Nothing in this section should be taken to require a linear user interface to session history, even though the processing model depends on a linear list. Conforming implementations may use a tree or any other method of organizing what is presented to the user.

use newer URI RFC?

4.1. Object Relationships

In addition to the Window object itself, navigation involves a number of other objects. In addition to the Window object and the document, there are two other objects that participate in navigation, the Location object and the History object.

These objects are, like the Window object, associated with a specific browsing context.

This would be a good place to add a diagram of object relationships - someone with art skills please help!
Should define which objects are replaced on a navigation and which aren't. Window is not replaced, document sometimes is as mentioned above. With history and location I think it may vary per browser. Needs research.

All requirements for performing algorithms are "as if" requirements - all observable behavior must be as if the conforming implementation had performed the required steps, but this specification makes no requirements on how this effect is achieved.

4.2.1. URI Parsing

The following algorithms are applied when parsing absolute URI references into components. Absolute URI references are parsed according to Uniform Resource Identifiers (URI): Generic Syntax [RFC2396], but the strings of interest when dealing with browsing context navigation are often somewhat different than the RFC standard pieces.

parseHash(URI-Ref, preserve-empty)
  1. If URI-Ref has a non-empty fragment identifier [RFC2396], or has an empty fragment identifier and preserve-empty is true, return the concatenation of a number sign (#) and the fragment identifier; and do not proceed to step 2. Otherwise go to step 2.
  2. Return the empty string.
parseHost(URI-Ref)
Return the result of the following steps:
  1. If URI-Ref is hierarchical and uses a server-based naming authority [RFC2396], return the hostport [RFC2396] portion of the naming authority and do not proceed to step 2. Otherwise go to step 2.
  2. Return the empty string.
parseHostname(URI-Ref)
Return the result of the following steps:
  1. If URI-Ref is hierarchical and uses a server-based naming authority [RFC2396], return the host [RFC2396] portion of the naming authority and do not proceed to step 2. Otherwise go to step 2.
  2. Return the empty string.
parsePathname(URI-Ref)
  1. If URI-Ref is hierarchical, return the abs_path [RFC2396] portion; and do not proceed to step 2. Otherwise go to step 2.
  2. Return the empty string.
parsePort(URI-Ref)
Return the result of the following steps:
  1. If URI-Ref is hierarchical and uses a server-based naming authority [RFC2396], return the port [RFC2396] portion of the naming authority and do not proceed to step 2. Otherwise go to step 2.
  2. Return the empty string.
parseProtocol(URI-Ref)
Return the concatenation of the URI-Ref's scheme [RFC2396] and a colon (:).
parseSearch(URI-Ref, preserve-empty)
  1. If URI-Ref is hierarchical and has a non-empty query [RFC2396], or has an empty query and preserve-empty is true, return the concatenation of a question mark (?) and the query; and do not proceed to step 2. Otherwise go to step 2.
  2. Return the empty string.
reconstructURI(protocol, host, pathname, query, fragment)
  1. Let recunstructed-URI be the empty string.
  2. Append protocol to reconstructed-URI.
  3. If host is not the empty string, append the concatenation of "//" and host to reconstructed-URI.
  4. Append pathname to recostructed-URI.
  5. Append query to recostructed-URI.
  6. Append fragment to recostructed-URI.
  7. Return recostructed-URI.

4.2.2. Browsing Context State

A conforming implementation MUST store several items of internal state for each browsing context:

session-history
A sequence of absolute URI references representing the session history. session-history[n] for an integer n is the n-th entry in the session history
current-history-position
An integer giving the index of the entry in the session history currently being presented in this browsing context, i.e. the current history position.
current-location
The absolute URI reference given by session-history[current-history-position].
pending-location
Either a string containing an absolute URI reference or null. This is used as part of the algorithms that perform various navigations.
pending-navigation-type
The value of this internal property is one of "normal", "replace", "reload" or "history".
pending-history-position
An integer used when a history navigation is pending.

4.2.3. Performing Navigations

The following algorithms are used to perform navigations. Many of the surprisingly detailed definitions are required for interoperability.

When a browsing context is REQUIRED to actuate the pending navigation, it MUST perform the following steps:

  1. If pending-location is null, terminate this algorithm without performing any further steps.
  2. Start the process of navigating to the absolute URI reference specified by pending-location.
  3. If pending-navigation-type is "reload", then the load MUST result in a new document being created, even though this is not normally the case for loads of the same base location. Conforming implementations MAY load the document and referenced resources from origin, bypassing normal caching rules.
  4. Wait until enough of the document has loaded that the browsing context is ready to start presenting it.
  5. If pending-navigation-type is "replace" or "reload", then set session-history[current-history-position] to pending-location.
  6. If pending-navigation-type is "history", then set current-history-position to pending-history-position.
  7. If pending-navigation-type is "normal", then remove all items in session-history after current-history-position, append pending-location, and increase current-history-position by 1.
  8. Set pending-location to null.
Navigation that only changes the hash may need to be special-cased; it may need to take effect immediately. Need to test.

When a browsing context is REQUIRED to navigate at the next opportunity to an absolute URI reference new-uri, it MUST perform the following steps:

  1. Set pending-location to new-uri.
  2. Set pending-navigation-type to "normal".
  3. Complete execution of any currently in-progress event dispatch [DOM3EV], timer callbacks, or execution of scripts from markup elements, such as the HTML, XHTML or SVG script element.
  4. Ensure that no further inline script execution takes place, no additional timers fire, no additional user events are processed for the current document until the next step is performed.
  5. Actuate the pending navigation.

When a browsing context is REQUIRED to replace the current location with a specified URI new-uri, it MUST perform the following steps:

  1. Set pending-location to new-uri.
  2. Set pending-navigation-type to "replace".
  3. Complete execution of any currently in-progress event dispatch [DOM3EV], timer callbacks, or execution of scripts from markup elements, such as the HTML, XHTML or SVG script element.
  4. Ensure that no further inline script execution takes place, no additional timers fire, no additional user events are processed for the current document until the next step is performed.
  5. Actuate the pending navigation.

When a browsing context is REQUIRED to reload the curent location, it MUST perform the following steps:

  1. Set pending-location to current-location.
  2. Set pending-navigation-type to "reload".
  3. Complete execution of any currently in-progress event dispatch [DOM3EV], timer callbacks, or execution of scripts from markup elements, such as the HTML, XHTML or SVG script element.
  4. Ensure that no further inline script execution takes place, no additional timers fire, no additional user events are processed for the current document until the next step is performed.
  5. Actuate the pending navigation.

When browsing contexts it REQUIRED to change history position by delta steps, they MUST perform the following steps:

  1. If delta is 0, reload the current location and terminate.
  2. Let new-history-position be delta added to current-history-position.
  3. If new-history-position is less than 0 or greater than or equal to the number of entries in session-history, then terminate.
  4. Set pending-history-position to new-history-position.
  5. Set pending-location to session-history[new-history-position].
  6. Set pending-navigation-type to "history".
  7. Complete execution of any currently in-progress event dispatch [DOM3EV], timer callbacks, or execution of scripts from markup elements, such as the HTML, XHTML or SVG script element.
  8. Ensure that no further inline script execution takes place, no additional timers fire, no additional user events are processed for the current document until the next step is performed.
  9. Actuate the pending navigation.

4.3. The Window Interface, Location Attributes


interface Window : views::AbstractView {
    // ...

    // assigning this has special behavior in ECMAScript, but it is otherwise
    // read only. specifically, in ES a string URI can be assigned to location,
    // having the same effect as location.assign(URI)
    readonly attribute Location location;
    readonly attribute History history;

    // ...
};

4.3.1. Attributes

Window objects MUST have the following attributes:

location
The value of the location attribute MUST be the Location object associated with the Window object's browsing context.
history
The value of the history attribute MUST be the History object associated with the Window object's browsing context.

4.4. The DocumentWindow Interface, Location Attributes


interface DocumentWindow  : views::DocumentView {
    // ...
    // same special JS assignment as window.location
    readonly attribute Location location;
    // ...
};

4.4.1. Attributes

DocumentWindow objects MUST implement the following attributes:

location
The value of the location attribute MUST be the Location object associated with the browsing context presenting the document. The value MUST be the same as the Location object for all views of the document.

4.5. The Location Interface

The Location interface is defined by the IDL interface below, which can also be found in the IDL Definitions Appendix.

An object that implements the Location interface is called a Location object.

Each Location object is associated with a browsing context. Many Location object methods and attributes operate on the browsing context


interface Location {
    attribute dom::DOMString href;

    // pieces of the URI, per the generic URI syntax
    attribute dom::DOMString hash;
    attribute dom::DOMString host;
    attribute dom::DOMString hostname;
    attribute dom::DOMString pathname;
    attribute dom::DOMString port;
    attribute dom::DOMString protocol;
    attribute dom::DOMString search;

    void assign(in dom::DOMString uri);
    void replace(in dom::DOMString uri);
    void reload();
};

4.5.1. Attributes

Location objects MUST implement the following attributes:

href
The value of the href attribute MUST be the browsing context's current-location. When the href attribute is set to a new value, the new value MUST not be reflected immediately. Instead, the Location's browsing context MUST navigate at the next opportunity to the newly set value.
ISSUE-67: Should resolution of relative URI references sent to location be defined in JS bindings or generally?
hash
The value of the hash attribute MUST be the result of parseHash(current-location, false). When this attribute is set to a new value new-hash, user agents MUST NOT change the value of the hash attribute but instead MUST perform the following steps:
  1. If new-hash does not start with a number sign (#), then let processed-new-hash be the concatenation of # and new-hash, otherwise let processed-new-hash be new-hash.
  2. Let new-uri be the result of reconstructURI(parseScheme(current-location), parseHost(current-location), parsePathname(current-location), parseSearch(current-location, true), processed-new-hash).
  3. Navigate at the next opportunity to new-uri.
host
The value of the host attribute MUST be the result of parseHost(current-location). When this atribute is set to a new value new-host, user agents MUST NOT change the value of the host attribute but instead MUST perform the following steps:
  1. Let new-uri be the result of reconstructURI(parseScheme(current-location), new-host, parsePathname(current-location), parseSearch(current-location, true), parseHash(current-location, true)).
  2. Navigate at the next opportunity to new-uri.
hostname
The value of the hostname attribute MUST be the result of parseHostname(current-location). When this atribute is set to a new value new-hostname, user agents MUST NOT change the value of the hostname attribute but instead MUST perform the following steps:
  1. Let current-port be the result of parsePort(current-location).
  2. If current-port is the empty string, then let new-host be new-hostname, otherwise let new-host be the concatentation of new-host, ":" and current-port.
  3. Let new-uri be the result of reconstructURI(parseScheme(current-location), new-host, parsePathname(current-location), parseSearch(current-location, true), parseHash(current-location, true)).
  4. Navigate at the next opportunity to new-uri.
pathname
The value of the pathname attribute MUST be the result of parsePathname(current-location). When this atribute is set to a new value new-pathname, user agents MUST NOT change the value of the pathname attribute but instead MUST perform the following steps:
  1. Let new-uri be the result of reconstructURI(parseScheme(current-location), parseHost(current-location), new-pathname, parseSearch(current-location, true), parseHash(current-location, true)).
  2. Navigate at the next opportunity to new-uri.
port
The value of the port attribute MUST be the result of parsePort(current-location). When this atribute is set to a new value new-port, user agents MUST NOT change the value of the port attribute but instead MUST perform the following steps:
  1. Let current-hostname be the result of parseHostname(current-location).
  2. Let new-host be the concatentation of current-hostname, ":" and new-port.
  3. Let new-uri be the result of reconstructURI(parseScheme(current-location), new-host, parsePathname(current-location), parseSearch(current-location, true), parseHash(current-location, true)).
  4. Navigate at the next opportunity to new-uri.
protocol
The value of the protocol attribute MUST be the result of parseProtocol(current-location). When this atribute is set to a new value new-protocol, user agents MUST NOT change the value of the protocol attribute but instead MUST perform the following steps:
  1. If new-protocol does not end with a colon (:), then let processed-new-protocol be the concatenation of new-protocol and a colon (:), otherwise let processed-new-protocol be new-protocol.
  2. Let new-uri be the result of reconstructURI(processed-new-protocol, parseHost(current-location), parsePathname(current-location), parseSearch(current-location, true), parseHash(current-location, true)).
  3. Navigate at the next opportunity to new-uri.
search
The value of the search attribute MUST be the result of parseSearch(current-location). When this atribute is set to a new value new-search, user agents MUST NOT change the value of the search attribute but instead MUST perform the following steps:
  1. If new-search does not start with a question mark (?), then let processed-new-search be the concatenation of ? and new-search, otherwise let processed-new-search be new-search.
  2. Let new-uri be the result of reconstructURI(parseScheme(current-location), parseHost(current-location), parsePathname(current-location), processed-new-search, parseHash(current-location, true)).
  3. Navigate at the next opportunity to new-uri.

4.5.2. Methods

Location objects MUST implement the following methods:

ISSUE-68: Should describe string conversion for various language bindings.
assign(uri)
When assign is called, the Location object MUST navigate at the next opportunity to uri.
replace(uri)
When replace is called, the Location object MUST replace the curent location with uri.
reload()
When assign is called, the Location object MUST reload the curent location.

4.6. The History Interface

The History interface is defined by the IDL interface below, which can also be found in the IDL Definitions Appendix.

An object that implements the History interface is called a History object.

Each History object is associated with a browsing context. Many History object methods and attributes operate on the browsing context


interface History {
  readonly attribute long length;
  void go(in long delta);
  void back();
  void forward();
};

4.6.1. Attributes

History objects MUST implement the following attributes:

length
The value of the length attribute MUST be the number of items in the browsing context's session history.

4.6.2. Methods

History objects MUST implement the following methods:

go(delta)
When go is called, the browsing context MUST change history position by delta steps.
In ECMAScript, can also be called with no args.
back()
When back is called, the browsing context MUST change history position by -1 steps.
back()
When forward is called, the browsing context MUST change history position by +1 steps.

5. Embedding: Compound Documents by Reference

An element that refers to another document which is then embedded is called an embedding element. A document embedded in such an element is called a child document. Seen from a child document, the embedding element is part of a parent document. When a document has no embedding element that points to it the document is a root document. A document can be both a parent document and child document at the same time.

The normative definitions of the various attributes should be moved to below the IDL to match other sections.

The value of the frameElement attribute of a Window object MUST be the embedding element, or null if there is no such element. The value of the parent attribute of a Window object MUST be the parent document's Window object or the document's Window object if there is no parent document. The value of the top attribute of a Window object MUST be the root document's Window object.

For the ES bindings appendix: In ECMAScript these DOM attributes, even though readonly, to be set to different values. In such cases the attributes are simply the values set by the script author.
This does not deal with security. Security should probably be taken care of in a separate part of the specification. That there is no restriction by design, but by security environment.

The name attribute of a Window object MUST be the name assigned by the embedding element, the empty string if there is no such element or a value set by the script author. How this name is extracted from the embedding element is language specific.

Need to mention that it can be set by Window.open() and the "target" attribute in some languages, basically anything that can open a new top-level browsing context.

For example, if you have <object data="file" id="test"/> in an XHTML document the name DOM attribute within file will be "test".

The value of the contentDocument attribute of an object that implements the EmbeddingElement interface MUST be the child document's Document object or null if there is no such object.

Need to discuss the possibility of embedding elements containing non-DOM content, like images or plugin content.
Likewise the contentWindow attribute of an object that implements the EmbeddingElement interface MUST be the child document's Window object or null if there is no such object.

5.1. The Window Interface, Embedding Attributes


interface Window {
    // name attribute of referencing frame/iframe/object, or name passed to
    // window.open
    attribute dom::DOMString name;

    // global object of containing document
    readonly attribute Window parent;

    // global object of outermost containing document
    readonly attribute Window top;

    // referencing <html:frame>, <html:iframe>, <html:object>, <svg:foreignObject>,
    // <svg:animation> or other embedding point, or null if none
    readonly attribute dom::Element frameElement;
};
This needs fixing to clearly state the conformance requirements.
This also needs to be merged with the above I think [anne].
parent
An attribute containing a reference to Window object that contains this object.
top
An attribute containing a reference to the topmost Window object in the hierarchy that contains this object.
name
An attribute containing a unique name used to refer to this Window object.
Need to describe how this could come from a containing element.
frameElement
@@TODO

5.2. The EmbeddingElement Interface


// must be on an object that also implements dom::Element
interface EmbeddingElement {
    readonly attribute dom::Document contentDocument;
    readonly attribute Window contentWindow;
};
Need actual description.

6. Timers

Need to describe processing model for timers.

6.1. The Window Interface, Timer Attributes


interface Window {
    // should timers allow more than long, maybe a floating point type?
    // don't think anyone's timers have more precision

    // one-shot timer
    long setTimeout(in TimerListener listener, in long milliseconds);
    void clearTimeout(in long timerID);

    // repeating timer
    long setInterval(in TimerListener listener, in long milliseconds);
    void clearInterval(in long timerID);
};
setTimeout(function, milliseconds)
This method calls the function once after a specified number of milliseconds elapses, until canceled by a call to clearTimeout. The methods returns a timerID which may be used in a subsequent call to clearTimeout to cancel the interval.
setInterval(function, milliseconds)
This method calls the function every time a specified number of milliseconds elapses, until canceled by a call to clearInterval. The methods returns an intervalID which may be used in a subsequent call to clearInterval to cancel the interval.
clearTimeout(timerID)
Cancels a timeout that was set with the setTimeout method.
clearInterval(intervalID)
Cancels an interval that was set with the setTimeout method.

6.2. The TimerListener Interface


// behavior is always special in ECMAScript, this is defined only for the benefit
// of other languages
interface TimerListener {
    // what to put here?
};
ISSUE-70: what to do about timers?
Need to define this. In ES bindings, a function or string is the only thing allowed.

7. Security Considerations

My current plan for the "security considerations" section is that it will contain the following:

I would rather not have normative requirements on when UAs must or must not throw exceptions or return null or whatever, since these would merely represent our best current understanding of how to implement the security policy.

It may be that some of this belongs in the main body of the spec instead of in Security Considerations, let's figure that out when the security part is actually written.

A. IDL Definitions

Need to fill in the full IDL here.

B. ECMAScript Language Binding

Need to define all the ECMAScript-specific issues, such as which properties are shadowable or replaceable, assigning to the location property, passing functions or strings as timers, etc.

C. Java Language Binding

Need to write this.

D. Acknowledgements

The WebAPI WG would like to thanks the following people for contributing to this specification:

Björn Höhrmann, Jim Ley, Cameron McCormack and Boris Zbarsky.

Special thanks to Anne van Kesteren for writing the Embedding section and many other additions and improvements.

Special thanks to Ian Hickson for making the first attempt to standardize the Window object in Web Apps 1.0, drafts of which heavily influenced this document. In particular, he coined the term "browsing context".

E. References

Need to be able to include organization and date for references.
Need appropriate cites for DOM Core and OMG IDL.
Need titles and authors for DOM2Views
Need titles and authors for DOM3Core
Need titles and authors for ECMAScript
Need titles and authors for Java
DOM2Views
,
DOM3Core
,
DOM3EV
Document Object Model (DOM) Level 3 Events Specification, Philippe Le Hégaret (W3C), and Tom Pixley (Netscape Communications Corporation).
ECMAScript
,
Java
,
RFC2119
Key words for use in RFCs to Indicate Requirement Levels, S. Bradner.
RFC2396
Uniform Resource Identifiers (URI): Generic Syntax, T. Berners-Lee, R. Fielding, and L. Masinter.