Event.type (Property)

A string that contains the event type name.


DOM level - 2
JavaScript - 1.2
JScript - 3.0
Internet Explorer - 4.0
Netscape - 4.0
Opera - 5.0
Property/method value type:String primitive
JavaScript syntax:-myEvent.type

The event types in pre-version 6.0 examples of Netscape are determined by matching against a bitmask, which is then used internally for capturing and routing events. Eventually during an event handler, an event is passed to a handler and the type property is set to a string that describes the event type.

The DOM level 2 event handling that is supported by Netscape version 6 works more like it did for the MSIE browser, although the event bubbling and event capture techniques are both available. The event type property is still available although the DOM level 2 event specification does not list a set of values but does mention some possible values incidentally. It does indicate that the value should be an XML name value as defined in the XML specification which simply describes its 'well formedness' but does not enumerate any valid event type values.

Certain name values are reserved. For example, the XML standard reserves all names beginning with "XML". The value is case-insensitive and this rule should apply after conversion from international characters to locale specific characters.

Likewise, the DOM standard reserves all names beginning with the string "DOM". It is also likewise case- and internationalization-insensitive in its reservation of this name start string.

The specification suggests that third party event definitions that are implementation-specific should include some kind of prefix to avoid namespace collisions.

Here are some event type names that can be observed by closely inspecting the DOM level 2 event specification:

ValueEvent object type
HTMLEventsHTML Element objects
MouseEventsMouseEvent object
MutationEventsMutationEvent object
UIEventsUIEvent object

The standard notes that Key events are not yet supported and will be added in a later DOM level.

See also:DocumentEvent.createEvent(), Event type constants, Event.initEvent(), XML name

Property attributes: