Class: ElementsArray

ElementsArray

new ElementsArray()

elements_array.js, line 9
Represents a list of elements

Members

staticElementsArray.this.length

Properties:
Name Type Description
length int of the array

Methods

_forEach(callback)

elements_array.js, line 92
Executes a callback once per array element

$elements._forEach(function(element) {
    elements.addClass(element, 'someClass');
});
Name Type Description
callback function

_map(callback)

elements_array.js, line 117
The _map() method creates a new array with the results of calling a provided function on every element in this array.

$elements._map(function(element) {
    return elements.getAttribute(element, 'data-view');
});
Name Type Description
callback function

_push(element)

elements_array.js, line 103
Push an element in this array

$elements._push(element);
Name Type Description
element HTMLEement

attr()

prototypes/dom.js, line 9
Prefer use of ElementsArray#getAttribute and ElementsArray#setAttribute

.attr(values)
.attr(name, value)

empty()

prototypes/dom_manipulation.js, line 30
Remove the children's elements

forEach(callback){ElementsArray}

elements_array.js, line 29
Executes a callback once per array element

$elements.forEach(function($element) {
    $element.addClass('someClass');
});
Name Type Description
callback function
Returns:
Type Description
ElementsArray return this

hide()

prototypes/visibility.js, line 29
Hide the elements (add the class .hidden)

isVisible()

prototypes/visibility.js, line 61
Return a map of element's visibility

map(callback)

elements_array.js, line 73
The map() method creates a new array with the results of calling a provided function on every element in this array.

$elements.map(function($element) {
    return $element.getAttribute('data-view');
});
Name Type Description
callback function

on(eventNames, selector, listener)

prototypes/events.js, line 138
Register a listener for a space separated list of events
Name Type Description
eventNames String
selector String optional
listener function

once(eventNames, selector, listener)

prototypes/events.js, line 192
Register a listener for a space separated list of events
Name Type Description
eventNames String
selector String optional
listener function
Example

Example usage of on with a button.

$('#my-button').on('click', (event) => {
    console.log(event.$element, event.$target);
}

onDelayed(delay, throttle, eventNames, selector, listener)

prototypes/events.js, line 307
Register a delayed listener for a space separated list of events Usefull for key typing events
Name Type Default Description
delay Number
throttle Number false optional
eventNames String
selector String optional
listener function
Example

Example usage of onDelayed.

$('#input-search').onDelayed(200, 'keyup', (event) => {
    console.log(event.$element.getValue()
}

prop()

prototypes/dom.js, line 20
Prefer use of ElementsArray#getProperty and ElementsArray#setProperty

.prop(properties)
.prop(name, value)

remove()

prototypes/dom_manipulation.js, line 14
Remove the elements from the DOM

show()

prototypes/visibility.js, line 13
Show the elements (remove the class .hidden)

some(callback){ElementsArray}

elements_array.js, line 49
Return a new ElementsArray with elements wich passed the tests implemented by the provided function.

$elements.some(function($element) {
    return $element.hasClass('someClass');
});
Name Type Description
callback function
Returns:
Type Description
ElementsArray a new {ElementsArray}

style()

prototypes/dom.js, line 31
Prefer use of ElementsArray#getStyle and ElementsArray#setStyle

.style(properties)
.style(name, value)

timeout()

element_prototype_and_array_prototype.js, line 40

.timeout(delay, callback($elements))

toggle()

prototypes/visibility.js, line 45
Toggle an element's visibility using the hidden class