Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

PointerEvent()

The PointerEvent() constructor creates a new synthetic and untrusted PointerEvent.

Syntax

 event = new PointerEvent(type, PointerEventInit);

Arguments

type
Is a DOMString representing the name of the event (see PointerEvent event types).
PointerEventInitOptional
Is a PointerEventInit dictionary, having the following fields:
  • "pointerId", optional and defaulting to "0", of type long, that sets the value of PointerEvent.
  • "width", optional and defaulting to "1", of type double, that sets the value of PointerEvent.
  • "height", optional and defaulting to "1", of type double, that sets the value of PointerEvent.
  • "pressure", optional and defaulting to "0", of type float, that sets the value of PointerEvent.
  • "tiltX", optional and defaulting to "0", of type long, that sets the value of PointerEvent.
  • "tiltY", optional and defaulting to "0", of type long, that sets the value of PointerEvent.
  • "pointerType", optional and defaulting to "", of type DOMString, that sets the value of PointerEvent.
  • "isPrimary", optional and defaulting to "false", of type Boolean, that sets the value of PointerEvent.

The PointerEventInit dictionary also accepts fields from the MouseEvent, UIEventInit and EventInit dictionaries.

Example

var moveEvent = new PointerEvent("pointermove");

var downEvent = new PointerEvent("pointerdown", 
   {pointerId: 1,
    bubbles: true, 
    cancelable: true, 
    pointerType: "touch",
    width: 100,
    height: 100,
    isPrimary: true
   }); 

Specifications

Specification Status Comment
Pointer Events – Level 2
The definition of 'PointerEvent' in that specification.
Editor's Draft Non-stable version.
Pointer Events
The definition of 'PointerEvent' in that specification.
Recommendation Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support No support[2] (Yes) [1] 10ms
11
No support No support
Feature Android Android Webview Chrome for Android Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile
Basic support No support No support No support No support No support 10 No support No support

[1] This feature is currently hidden behind a flag — to enable it and experiment, go to about:config and enable dom.w3c_pointer_events.enabled.

[2] In development, see: crbug.com/196799.

Document Tags and Contributors

 Contributors to this page: teoli, bethge, AFBarstow
 Last updated by: teoli,