Methods
(static) click(el)
Trigger a click event on the specified element
Parameters:
Name | Type | Description |
---|---|---|
el |
HTMLElement |
(static) focus(el)
Set focus on the specified element
Parameters:
Name | Type | Description |
---|---|---|
el |
HTMLElement |
(static) getEventTarget(e) → {EventTarget}
Return target event
Parameters:
Name | Type | Description |
---|---|---|
e |
Event |
Returns:
- Type
- EventTarget
(static) off(el, action, fn)
Remove an event listener from an element
Most of the time on, off, all and once will be used with one of Element, Window or XMLHttpRequest
But other DOM objects (like AudioContext) implement EventTarget interface (addEventListener is used under the hood) and can be valid parameters
Parameters:
Name | Type | Description |
---|---|---|
el |
Element | Document | Window | XMLHttpRequest | |
action |
String | The event to remove |
fn |
function | Function to remove on the given event |
(static) offAll(els, action, fn)
Remove an event listener from a collection of elements
Parameters:
Name | Type | Description |
---|---|---|
els |
Array.<(Element|Document|Window|XMLHttpRequest)> | NodeList.<(Element|Document|Window|XMLHttpRequest)> | |
action |
String | The event to remove |
fn |
function | Function to remove on the given event |
(static) on(el, action, fn)
Set an event listener on an element
Most of the time on, off, all and once will be used with one of Element, Window or XMLHttpRequest
But other DOM objects (like AudioContext) implement EventTarget interface (addEventListener is used under the hood) and can be valid parameters
Parameters:
Name | Type | Description |
---|---|---|
el |
Element | Document | Window | XMLHttpRequest | |
action |
String | The event to listen to |
fn |
function | Function to execute when event triggers |
(static) onAll(els, action, fn)
Set an event listener on a collection of elements
Parameters:
Name | Type | Description |
---|---|---|
els |
Array.<(Element|Document|Window|XMLHttpRequest)> | NodeList.<(Element|Document|Window|XMLHttpRequest)> | |
action |
String | The event to listen to |
fn |
function | Function to execute when event triggers |
(static) once(el, action, fn)
Set an event listener that triggers once on an element
Most of the time on, off, all and once will be used with one of Element, Window or XMLHttpRequest
But other DOM objects (like AudioContext) implement EventTarget interface (addEventListener is used under the hood) and can be valid parameters
Parameters:
Name | Type | Description |
---|---|---|
el |
Element | Document | Window | XMLHttpRequest | |
action |
String | The event to listen to |
fn |
function | Function to execute when event triggers |
(static) preventDefault(e)
Prevent default event from happening
Parameters:
Name | Type | Description |
---|---|---|
e |
Event |
(static) ready(fn)
Trigger a function when DOM is ready
Parameters:
Name | Type | Description |
---|---|---|
fn |
function |