-
Notifications
You must be signed in to change notification settings - Fork 1
Home
- Element
-
Wrapper class for DOM elements, initiate by passing a selector.
-
eventNamesValidation(eventNames, eventNamesList) ⇒
Array -
Match event names against given event names list.
-
findReverseBranch(leaf, tree) ⇒
Array -
Searches an EventsList array for a specific item and returns the trail from it.
-
HTMLElement :
Object -
DOM instance of an element.
-
QuerySelector :
String -
A CSS selector string
-
EventsList :
Array -
A nested list of 3 levels deep, with a unique structure.
Wrapper class for DOM elements, initiate by passing a selector.
Kind: global class
Creates an element instance of the query selector passed in.
Throws:
- When no query selector passed.
- When no HTML elements were found via passed query selector.
| Param | Type | Description |
|---|---|---|
| selector | String |
DOM query selector |
element.raw ⇒ HTMLElement
Get the instance of DOM element.
Kind: instance property of Element
element.toString ⇒ QuerySelector
Get the query selector string.
Kind: instance property of Element
Match event names against given event names list.
Kind: global function
Returns: Array - Array of valid event names.
Throws:
- When event name is not part of event names list.
| Param | Type | Description |
|---|---|---|
| eventNames | String |
String of event names separated by space. |
| eventNamesList | EventsList |
Nested array of event names. |
Example
const eventNames = 'click mouseover';
eventNamesValidation(eventNames, DOM_EVENTS_LIST);
// ['click', 'mouseover']Searches an EventsList array for a specific item and returns the trail from it.
Kind: global function
Returns: Array - Flat array that indicates the path to the leaf in reverse.
| Param | Type | Description |
|---|---|---|
| leaf | String |
String value to be found in the array |
| tree | EventsList |
Nested array of string values. |
Example
const tree = [['branch_1', ['leaf_1_1', 'leaf_1_2']], ['branch_2', ['leaf_2_1']], 'leaf_0'];
const leaf = 'leaf_1_2';
console.log(
'The branch is:', findReverseBranch(leaf, tree)
);
// ['leaf_1_2', 'branch_1']DOM instance of an element.
A CSS selector string
A nested list of 3 levels deep, with a unique structure.
Kind: global typedef
Example
// [[key, [...values]], ...values]
const eventsList = [
['keys', ['keypress', 'keyup', 'keydown']],
['clicks', ['click', 'dblclick']],
'resize',
'reset'
];