# tinymce.dom.EventUtils

Namespace | tinymce.dom
Class | EventUtils

This class handles DOM events in a cross platform fasion it also keeps track of element and handler references to be able to clean elements to reduce IE memory leaks.

## Public Methods

Method | Defined By
--- | ---
EventUtils() Constructs a new EventUtils instance. | EventUtils
add(o:Element/Document/Window/Array/String, n:String/Array, f:function, s:Object):function Adds an event handler to the specified object. | EventUtils
cancel(e:Event):Boolean Cancels an event for both bubbeling and the default browser behavior. | EventUtils
clear(o:Object):void Clears all events of a specific object. | EventUtils
destroy():void Destroys the instance. | EventUtils
prevent(e:Event):Boolean Prevent default browser behvaior of an event. | EventUtils
remove(o:String/Element/Array, n:String, f:function):bool/Array Removes the specified event handler by name and function from a element or collection of elements. | EventUtils
stop(e:Event):Boolean Stops propogation/bubbeling of an event. | EventUtils

## Method details

### EventUtilsconstructor

`public function EventUtils()`
Constructs a new EventUtils instance.

### addmethod

`public function add(o:Element/Document/Window/Array/String, n:String/Array, f:function, s:Object):function`
Adds an event handler to the specified object.

#### Parameters

o:Element/Document/Window/Array/String | Object or element id string to add event handler to or an array of elements/ids/documents.
n:String/Array | Name of event handler to add for example: click.
f:function | Function to execute when the event occurs.
s:Object | Optional scope to execute the function in.

#### Returns

function - Function callback handler the same as the one passed in.

#### Example

### cancelmethod

`public function cancel(e:Event):Boolean`
Cancels an event for both bubbeling and the default browser behavior.

#### Parameters

e:Event | Event object to cancel.

#### Returns

Boolean - Always false.

### clearmethod

`public function clear(o:Object):void`
Clears all events of a specific object.

#### Parameters

o:Object | DOM element or object to remove all events from.

#### Example

### destroymethod

`public function destroy():void`
Destroys the instance.

### preventmethod

`public function prevent(e:Event):Boolean`
Prevent default browser behvaior of an event.

#### Parameters

e:Event | Event to prevent default browser behvaior of an event.

#### Returns

Boolean - Always false.

### removemethod

`public function remove(o:String/Element/Array, n:String, f:function):bool/Array`
Removes the specified event handler by name and function from a element or collection of elements.

#### Parameters

o:String/Element/Array | Element ID string or HTML element or an array of elements or ids to remove handler from.
n:String | Event handler name like for example: "click"
f:function | Function to remove.

#### Returns

bool/Array - Bool state if true if the handler was removed or an array with states if multiple elements where passed in.

#### Example

### stopmethod

`public function stop(e:Event):Boolean`
Stops propogation/bubbeling of an event.

#### Parameters

e:Event | Event to cancel bubbeling on.

#### Returns

Boolean - Always false.