mail us  |  mail this page

contact us
training  | 
tech stuff  | 

Tech Stuff - DOM Events

W3C Event Reference. Part of the Events Interface.

Events

The following notes apply:

  1. Events bubble UP. Event listeners may be registered at various levels in the object hierarchy for the same event.
  2. Events may be canceled at any level (if allowed).
  3. We use the terms properties - W3C use the term attributes.
  4. We use the term object - W3C use the term element.
  5. EventTarget is the object in object.addEventListener(params).
  6. DOM-2 does not define keyboard events.
  7. Mutation events are triggered when the page is changed.

Event Properties

The following properties (attributes) are exposed when an event is triggered (an event object is created). ALL properties (attributes) below are READ ONLY.

Property Description
altKey boolean - true if alt key pressed
button 0 = right, 1 = middle, 2 = left. More than one button may be indicated. In Gecko not valid on mousemove, mouseout, mouseover.
clientX the horizontal offset in pixels from the parent node of this object.
clientY the vertical offset in pixels from the parent node of this object.
ctrlKey boolean - true = control key pressed.
metaKey boolean true = meta key pressed.
relatedTarget on 'mouseover' should be object being exited. For 'mouseout' should be the object being entered.
screenX the horizontal offset in pixels from the origin of the screen.
screenY the vertical offset in pixels from the origin of the screen.
shiftKey boolean true = shift key was pressed.
bubbles boolean true = event can bubble.
cancelable boolean true = event can be canceled.
currentTarget the name of the object currently being processed.
eventPhase may be:
AT_TARGET - evaluation (being initialised)
BUBBLING_PHASE
CAPTURING_PHASE.
target indicates the target to which the event was originally dispatched.
timeStamp time in milliseconds from 1st January 1970 (UCT) or 0 if not available.
type the name of the event.
detail event specific details.
view identifies the AbstractView for the event (?).
attrChange Mutation. Indicates the type of change may be: ADDITION, MODIFICATION, REMOVAL.
attrName Mutation. The name of object that changed.
newValue Mutation. The new value of the object.
prevValue Mutation. The previous value of the object.
relatedNode Mutation. Indicates the actual node changed if an indirect event was created (the event was triggered by a change to another node which may be higher or lower in the hierarchy).

Event Methods

The following methods are exposed when an event is triggered (an event object is created).

Method Description
addEventListener adds an event listener for the defined event type for the specified object.
dispatchevent fires an event created by a createEvent followed by an initEvent.
removeEventListener removes an event listener for the defined event type for the specified object.
initEvent initialises an event that is subsequently fired by the dispatchEvent method.
preventDefault stops the event bubbling (this lets you stop the default context menu on right mouse click).
stopPropagation stops further event triggering at higher levels in the object hierarchy (this lets you stop the default context menu on right mouse click).
createEvent called as part of a sequence to fire an event createEvent->initMouseEvent->dispatchevent.
initUIEvent initialises a UI event that is subsequently fired by the dispatchEvent method.
initMouseEvent initialises a Mouse event that is subsequently fired by the dispatchEvent method.
initMutationEvent initialises a Mutation event that is subsequently fired by the dispatchEvent method.


Problems, comments, suggestions, corrections (including broken links) or something to add? Please take the time from a busy life to 'mail us' (at top of screen), the webmaster (below) or info-support at zytrax. You will have a warm inner glow for the rest of the day.

Tech Stuff

RSS Feed Icon

If you are happy it's OK - but your browser is giving a less than optimal experience on our site. You could, at no charge, upgrade to a W3C standards compliant browser such as Firefox

Search

web zytrax.com

Share

Icons made by Icomoon from www.flaticon.com is licensed by CC 3.0 BY
share page via facebook tweet this page

Page

email us Send to a friend feature print this page Display full width page Decrease font size Increase font size

Resources

HTML Stuff

W3C HTML 4.01
HTML5 (WHATWG)
HTML4 vs HTML5
HTML5 Reference
W3C Page Validator
W3C DOCTYPE

CSS Stuff

W3C CSS2.1
W3C CSS2.2
Default Styles
CSS3 Selectors
CSS 3 Media Queries
CSS 3 Colors

DOM Stuff

W3C DOM
W3C DOM 3 Core
W3C 3 Events

Accessibility

usability.gov
W3C - WAI
Web Style Guide
WebAim.org

Useful Stuff

Peter-Paul Koch
A List Apart
Eric Meyer on CSS
glish.com

Our Stuff

Our DOM Pages
DOM Navigation
Liquid Layout
CSS Short Cuts
CSS overview
CSS One Page

Javascript Stuff

ECMA-262

Site

CSS Technology SPF Record Conformant Domain
Copyright © 1994 - 2017 ZyTrax, Inc.
All rights reserved. Legal and Privacy
site by zytrax
Hosted by super.net.sg
web-master at zytrax
Page modified: October 21 2015.