1. Introduction
2. Overview
TODO.
3. Conformance
Boilerplate?
4. Stylistic Conventions
This specification follows the Proposed W3C Specification Conventions, with the following supplemental additions:
This is a note.
This is an open issue.
This is a warning.
interface Example { // This is an IDL definition. };
5. User Interface Events
The User Interface event module contains basic event types associated with user interfaces and document manipulation.
5.1. Interface UIEvent
Introduced in DOM Level 2
The UIEvent
interface provides specific contextual information
associated with User Interface events.
To create an instance of the UIEvent
interface, use the UIEvent
constructor, passing an optional UIEventInit
dictionary.
For newly defined events, you don’t have to inherit UIEvent
interface just
because they are related to user interface. Inherit only when members of UIEventInit
make sense to those events.
5.1.1. UIEvent
[Exposed =Window ]interface :
UIEvent Event {(
constructor DOMString ,
type optional UIEventInit = {});
eventInitDict readonly attribute Window ?;
view readonly attribute long ; };
detail
UIEvent . view
-
The
view
attribute identifies theWindow
from which the event was generated.The un-initialized value of this attribute MUST be
null
. UIEvent . detail
-
Specifies some detail information about the
Event
, depending on the type of event.The un-initialized value of this attribute MUST be
0
.
5.1.2. UIEventInit
dictionary :
UIEventInit EventInit {Window ?=
view null ;long = 0; };
detail
UIEventInit . view
- Should be initialized to the Window object of the global
environment in which this event will be dispatched. If this
event will be dispatched to an element, the view property should
be set to the Window object containing the element’s
ownerDocument
. UIEventInit . detail
- This value is initialized to a number that is application-specific.
5.2. UI Event Types
The User Interface event types are listed below. Some of these events
use the UIEvent
interface if generated from a user interface, but
the Event
interface otherwise, as detailed in each event.
5.2.1. load
Type | load
|
---|---|
Interface | UIEvent if generated from a user interface, Event otherwise.
|
Sync / Async | Async |
Bubbles | No |
Trusted Targets | Window , Document , Element
|
Cancelable | No |
Default action | None |
Context (trusted events) |
A user agent MUST dispatch this event when the DOM
implementation finishes loading the resource (such as the document)
and any dependent resources (such as images, style sheets, or
scripts). Dependent resources that fail to load MUST NOT prevent
this event from firing if the resource that loaded them is still
accessible via the DOM. If this event type is dispatched,
implementations are REQUIRED to dispatch this event at least on the Document
node.
For legacy reasons, load
events for resources inside the
document (e.g., images) do not include the Window in the
propagation path in HTML implementations. See [HTML5] for more
information.
5.2.2. unload
Type | unload
|
---|---|
Interface | UIEvent if generated from a user interface, Event otherwise.
|
Sync / Async | Sync |
Bubbles | No |
Trusted Targets | Window , Document , Element
|
Cancelable | No |
Default action | None |
Context (trusted events) |
A user agent MUST dispatch this event when the DOM
Implementation removes from the environment the resource (such as
the document) or any dependent resources (such as images, style
sheets, scripts). The document MUST be unloaded after the dispatch
of this event type. If this event type is dispatched,
implementations are REQUIRED to dispatch this event at least on
the Document
node.
5.2.3. abort
Type | abort
|
---|---|
Interface | UIEvent if generated from a user interface, Event otherwise.
|
Sync / Async | Sync |
Bubbles | No |
Trusted Targets | Window , Element
|
Cancelable | No |
Default action | None |
Context (trusted events) |
A user agent MUST dispatch this event when the loading of a resource has been aborted, such as by a user canceling the load while it is still in progress.
5.2.4. error
Type | error
|
---|---|
Interface | UIEvent if generated from a user interface, Event otherwise.
|
Sync / Async | Async |
Bubbles | No |
Trusted Targets | Window , Element
|
Cancelable | No |
Default action | None |
Context (trusted events) |
A user agent MUST dispatch this event when a resource failed to load, or has been loaded but cannot be interpreted according to its semantics, such as an invalid image, a script execution error, or non-well-formed XML.
5.2.5. select
Type | select
|
---|---|
Interface | UIEvent if generated from a user interface, Event otherwise.
|
Sync / Async | Sync |
Bubbles | Yes |
Trusted Targets | Element
|
Cancelable | No |
Default action | None |
Context (trusted events) |
A user agent MUST dispatch this event when a user selects some text. This event is dispatched after the selection has occurred.
This specification does not provide contextual information to access
the selected text. Where applicable, a host language SHOULD
define rules for how a user MAY select content (with consideration
for international language conventions), at what point the select
event is dispatched, and how a content author MAY
access the user-selected content.
In order to access to user-selected content, content authors will
use native capabilities of the host languages, such as the Document.getSelection()
method of the HTML Editing APIs [Editing].
The select
event might not be available for all elements in
all languages. For example, in [HTML5], select
events can
be dispatched only on form input
and textarea
elements.
Implementations can dispatch select
events in any context
deemed appropriate, including text selections outside of form
controls, or image or markup selections such as in SVG.
6. Legacy Event Initializers
This section is normative.
The following features are obsolete and should only be implemented by user agents that require compatibility with legacy software.
Early versions of this specification included an initialization method on
the interface (for example initMouseEvent
) that required a long
list of parameters that, in most cases, did not fully initialize all
attributes of the event object. Because of this, event interfaces which were
derived from the basic Event
interface required that the initializer of each of the derived interfaces be called explicitly in order to
fully initialize an event.
initEvent
and initMutationEvent
. Due in part to the length of time in the development of this standard, some implementations MAY have taken a dependency on these (now deprecated) initializer methods. For completeness, these legacy event initializers are described in this section.
6.1. Initializers for interface UIEvent
This section is informative
partial interface UIEvent { // Deprecated in this specificationundefined initUIEvent (DOMString ,
typeArg optional boolean =
bubblesArg false ,optional boolean =
cancelableArg false ,optional Window ?=
viewArg null ,optional long = 0); };
detailArg
initUIEvent(typeArg)
-
Initializes attributes of an
UIEvent
object. This method has the same behavior asinitEvent()
.The
initUIEvent
method is deprecated, but supported for backwards-compatibility with widely-deployed implementations.- DOMString typeArg
- Refer to the
initEvent()
method for a description of this parameter. - boolean bubblesArg
- Refer to the
initEvent()
method for a description of this parameter. - boolean cancelableArg
- Refer to the
initEvent()
method for a description of this parameter. - Window? viewArg
- Specifies
view
. This value MAY benull
. - long detailArg
- Specifies
detail
.
7. Other UIEvents [DELETE]
This section will be deleted.
Temporary place to "define" other referenced UI Events (to make the bikeshed linker happy). This will be deleted once we have proper cross-references.
7.1. Things defined in other sections
7.1.1. Activation triggers and behavior
7.1.2. Composition Events
7.1.3. Default actions and cancelable events
7.1.4. Event dispatch and DOM event flow
7.1.5. Focus Events
7.1.6. Web browsers and other dynamic or interactive user agents
7.1.7. Authoring tools
Add references to these events so that the linker doesn’t complain about exporting them.
8. Glossary [DELETE]
This section will be deleted.
Temporary glossary terms (for bikeshed linker). Many of these are properly defined elsewhere and should be linked to directly. Terms which should be defined in this spec should be defined inline.
- host language
-
Any language which integrates the features of another language or API specification, while normatively referencing the origin specification rather than redefining those features, and extending those features only in ways defined by the origin specification. An origin specification typically is only intended to be implemented in the context of one or more host languages, not as a standalone language. For example, XHTML, HTML, and SVG are host languages for UI Events, and they integrate and extend the objects and models defined in this specification.
- un-initialized value
-
The value of any event attribute (such as
bubbles
orcurrentTarget
) before the event has been initialized withinitEvent()
. The un-initialized values of an event apply immediately after a new event has been created using the methodcreateEvent()
. - user agent
-
A program, such as a browser or content authoring tool, normally running on a client machine, which acts on a user’s behalf in retrieving, interpreting, executing, presenting, or creating content. Users MAY act on the content using different user agents at different times, for different purposes. See the § 7.1.6 Web browsers and other dynamic or interactive user agents and § 7.1.7 Authoring tools for details on the requirements for a conforming user agent.
- Window
-
The
Window
is the object referred to by the current document’s browsing context’s Window Proxy object as defined in HTML5 [HTML5].