#

API Docs for: 3.10.3
Show: Inherited Protected Private Deprecated

# DOMEventFacade Class

Defined in: `event/js/event-facade-dom.js:8`
Module: event-base
Parent Module: event

Wraps a DOM event, properties requiring browser abstraction are fixed here. Provids a security layer when required.

- Index
- Methods
- Properties

## Item Index

### Methods

- _define static
- _touch
- halt
- preventDefault
- resolve
- stopImmediatePropagation
- stopPropagation

### Properties

- _event
- _GESTURE_MAP static
- altKey
- button
- changedTouches
- charCode
- clientX
- clientY
- ctrlKey
- currentTarget
- keyCode
- metaKey
- pageX
- pageY
- relatedTarget
- shiftKey
- target
- targetTouches
- touches
- type
- webkitKeymap
- wheelDelta
- which

## Methods

### `_define`

(

- `o`
- `prop`
- `valueFn`

)
private static

Provided by the event module.

Defined in `event/js/event-facade-dom-ie.js:209`

Wrapper function for Object.defineProperty that creates a property whose value will be calulated only when asked for. After calculating the value, the getter wll be removed, so it will behave as a normal property beyond that point. A setter is also assigned so assigning to the property will clear the getter, so foo.prop = 'a'; foo.prop; won't trigger the getter, overwriting value 'a'.

Used only by the DOMEventFacades used by IE8 when the YUI configuration `lazyEventFacade` is set to true.

#### Parameters:

- `o` DOMObject

  A DOM object to add the property to

- `prop` String

  The name of the new property

- `valueFn` Function

  The function that will return the initial, default value for the property.

### `_touch`

(

- `ev`
- `currentTarget`
- `wrapper`

)
private

Provided by the event-touch module.

Defined in `event/js/event-facade-dom-touch.js:20`

Adds touch event facade normalization properties to the DOM event facade

#### Parameters:

- `ev` Event

  the DOM event

- `currentTarget` HTMLElement

  the element the listener was attached to

- `wrapper` Event.Custom

  the custom event wrapper for this DOM event

### `halt`

(

- `immediate`

)

Defined in `event/js/event-facade-dom.js:319`

Stops the event propagation and prevents the default event behavior.

#### Parameters:

- `immediate` Boolean

  if true additional listeners on the current target will not be executed

### `preventDefault`

(

- `returnValue`

)

Defined in `event/js/event-facade-dom.js:311`

Prevents the event's default behavior

#### Parameters:

- `returnValue` String

  sets the returnValue of the event to this value (rather than the default false value). This can be used to add a customized confirmation query to the beforeunload event).

### `resolve`

() private

Defined in `event/js/event-facade-dom.js:40`

Returns a wrapped node. Intended to be used on event targets, so it will return the node's parent if the target is a text node.

If accessing a property of the node throws an error, this is probably the anonymous div wrapper Gecko adds inside text nodes. This likely will only occur when attempting to access the relatedTarget. In this case, we now return null because the anonymous div is completely useless and we do not know what the related target was because we can't even get to the element's parent node.

### `stopImmediatePropagation`

()

Defined in `event/js/event-facade-dom.js:304`

Stops the propagation to the next bubble target and prevents any additional listeners from being exectued on the current target.

### `stopPropagation`

()

Defined in `event/js/event-facade-dom.js:299`

Stops the propagation to the next bubble target

## Properties

### `_event`

Native DOM Event private

Defined in `event/js/event-facade-dom.js:182`

The native event

### `_GESTURE_MAP`

Object static

Provided by the event-touch module.

Defined in `event/js/event-facade-dom-touch.js:162`

A object literal with keys "start", "end", and "move". The value for each key is a string representing the event for that environment. For touch environments, the respective values are "touchstart", "touchend" and "touchmove". Mouse and MSPointer environments are also supported via feature detection.

### `altKey`

Boolean

Defined in `event/js/event-facade-dom.js:196`

`true` if the "alt" or "option" key is pressed.

### `button`

Number

Defined in `event/js/event-facade-dom.js:261`

The button that was pushed. 1 for left click, 2 for middle click, 3 for right click. This is only reliably populated on `mouseup` events.

### `changedTouches`

DOMEventFacade[]

Provided by the event-touch module.

Defined in `event/js/event-facade-dom-touch.js:81`

An array of event-specific touch events.

For `touchstart`, the touch points that became active with the current event.

For `touchmove`, the touch points that have changed since the last event.

For `touchend`, the touch points that have been removed from the touch surface.

### `charCode`

Number

Defined in `event/js/event-facade-dom.js:255`

The charCode for key events. Same as keyCode

### `clientX`

Number

Defined in `event/js/event-facade-dom.js:237`

The X location of the event in the viewport

### `clientY`

Number

Defined in `event/js/event-facade-dom.js:243`

The Y location of the event in the viewport

### `ctrlKey`

Boolean

Defined in `event/js/event-facade-dom.js:218`

`true` if the "Ctrl" or "control" key is pressed.

### `currentTarget`

Node

Defined in `event/js/event-facade-dom.js:280`

Node reference for the element that the listener was attached to.

### `keyCode`

Number

Defined in `event/js/event-facade-dom.js:249`

The keyCode for key events. Uses charCode if keyCode is not available

### `metaKey`

Boolean

Defined in `event/js/event-facade-dom.js:210`

`true` if the "Windows" key on a Windows keyboard, "command" key on an Apple keyboard, or "meta" key on other keyboards is pressed.

### `pageX`

Number

Defined in `event/js/event-facade-dom.js:225`

The X location of the event on the page (including scroll)

### `pageY`

Number

Defined in `event/js/event-facade-dom.js:231`

The Y location of the event on the page (including scroll)

### `relatedTarget`

Node

Defined in `event/js/event-facade-dom.js:286`

Node reference to the relatedTarget

### `shiftKey`

Boolean

Defined in `event/js/event-facade-dom.js:203`

`true` if the shift key is pressed.

### `target`

Node

Defined in `event/js/event-facade-dom.js:274`

Node reference for the targeted element

### `targetTouches`

DOMEventFacade[]

Provided by the event-touch module.

Defined in `event/js/event-facade-dom-touch.js:58`

Array of individual touch events still in contact with the touch surface and whose `touchstart` event occurred inside the same taregt element as the current target element.

### `touches`

DOMEventFacade[]

Provided by the event-touch module.

Defined in `event/js/event-facade-dom-touch.js:39`

Array of individual touch events for touch points that are still in contact with the touch surface.

### `type`

String

Defined in `event/js/event-facade-dom.js:189`

The name of the event (e.g. "click")

### `webkitKeymap`

Unknown private

Defined in `event/js/event-facade-dom.js:21`

webkit key remapping required for Safari < 3.1

### `wheelDelta`

Number

Defined in `event/js/event-facade-dom.js:292`

Number representing the direction and velocity of the movement of the mousewheel. Negative is down, the higher the number, the faster. Applies to the mousewheel event.

### `which`

Number

Defined in `event/js/event-facade-dom.js:268`

The button that was pushed. Same as button.