Readonly
[unscopables]Is an object whose properties have the value 'true' when they will be absent when used in a 'with' statement.
Optional
Readonly
[unscopables]?: booleanIs an object whose properties have the value 'true' when they will be absent when used in a 'with' statement.
Optional
length?: booleanGets or sets the length of the array. This is a number one higher than the highest index in the array.
Gets or sets the length of the array. This is a number one higher than the highest index in the array.
Static
Readonly
[species]Add one or more class names to each Element
in the collection.
Rest
...names: string[]One or more class names.
The current collection.
new EagleJS(element).addClass('className');
new EagleJS(element).addClass('className', 'className');
Element.classList.add() on MDN.
DOMException
Throws a SyntaxError
if one of the arguments is the empty string.
DOMException
Throws an InvalidCharacterError
if one of the arguments contains any
ASCII whitespace.
Insert a set of Node
or DOMString
objects after each ChildNode
in the
collection. DOMString
objects are inserted as equivalent Text
nodes.
Rest
...nodes: (string | Node)[]A set of Node
or DOMString
objects to insert.
The current collection.
new EagleJS(element).after('text');
new EagleJS(element).after(Node);
new EagleJS(element).after('text', Node);
new EagleJS(element).after(Node, Node);
ChildNode.after() on MDN.
Insert a set of Node
or DOMString
objects after the last child of each
ParentNode
in the collection. DOMString
objects are inserted as
equivalent Text
nodes.
Rest
...nodes: (string | Node)[]A set of Node
or DOMString
objects to insert.
The current collection.
new EagleJS(element).append('text');
new EagleJS(element).append(Node);
new EagleJS(element).append('text', Node);
new EagleJS(element).append(Node, Node);
ParentNode.append() on MDN.
Get the attribute value of the first Element
in the collection.
The name of the attribute.
The attribute value of the first Element
.
Element.getAttribute() on MDN.
DOMException
Throws an InvalidCharacterError
if the specified attribute name contains
one or more characters that are not valid in attribute names.
Set the attribute value of each Element
in the collection.
The name of the attribute.
The value for the attribute.
Returns the current collection.
Element.setAttribute() on MDN.
DOMException
Throws an InvalidCharacterError
if the specified attribute name contains
one or more characters that are not valid in attribute names.
Insert a set of Node
or DOMString
objects before each ChildNode
in
the collection. DOMString
objects are inserted as equivalent Text
nodes.
Rest
...nodes: (string | Node)[]A set of Node
or DOMString
objects to insert.
The current collection.
new EagleJS(element).before('text');
new EagleJS(element).before(Node);
new EagleJS(element).before('text', Node);
new EagleJS(element).before(Node, Node);
ChildNode.before() on MDN.
Create a clone of each Node
in the collection.
If true
, then Node
and its whole subtree—including text
that may be in child Text
nodes—is also copied.
A new collection of Node
s.
new EagleJS(element).clone();
new EagleJS(element).clone(true);
new EagleJS(element).clone(false);
Node.cloneNode() on MDN.
DOMException
Throws a NotSupportedError
if Node
is a ShadowRoot.
Get the closest ancestor of each Element
in the collection that matches
selectors.
One or more selectors to match.
A new collection of Element
s.
Element.closest() on MDN.
DOMException
Throws a SyntaxError
if the syntax of the specified selectors
is not
valid.
Returns the this object after copying a section of the array identified by start and end to the same array starting at position target
If target is negative, it is treated as length+target where length is the length of the array.
If start is negative, it is treated as length+start. If end is negative, it is treated as length+end.
Optional
end: numberIf not specified, length of the this object is used as its default value.
Get the dataset
of the first HTMLElement
or SVGElement
in the
collection.
The dataset of the first HTMLElement
or SVGElement
.
HTMLOrForeignElement.dataset on MDN.
Get the data attribute value of the first HTMLElement
or SVGElement
in
the collection.
The name of the data.
Returns the data attribute value of the first HTMLElement
or
SVGElement
.
HTMLOrForeignElement.dataset on MDN.
Set the data attribute value of each HTMLElement
and SVGElement
in the
collection.
The name of the data.
The new data value.
Returns the current collection.
HTMLOrForeignElement.dataset on MDN.
Remove all child nodes of each Node
in the collection from the DOM.
The current collection.
Node.removeChild() on MDN.
Determines whether all the members of an array satisfy the specified test.
A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.
Optional
thisArg: anyAn object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
Determines whether all the members of an array satisfy the specified test.
A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.
Optional
thisArg: anyAn object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
Changes all array elements from start
to end
index to a static value
and returns the modified array
value to fill array section with
Optional
start: numberindex to start filling the array at. If start is negative, it is treated as length+start where length is the length of the array.
Optional
end: numberindex to stop filling the array at. If end is negative, it is treated as length+end.
Returns the value of the first element in the array where predicate is true, and undefined otherwise.
find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.
Optional
thisArg: anyIf provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.
Optional
thisArg: anyReturns the index of the first element in the array where predicate is true, and -1 otherwise.
find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1.
Optional
thisArg: anyIf provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.
Performs the specified action for each element in an array.
A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
Optional
thisArg: anyAn object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
Check if any collection Element
has the specified attribute.
The attribute to search.
true
if any Element
has the given attribute; otherwise,
false
.
Element.hasAttribute() on MDN
Check if any collection Element
has the specified class name.
The class name to search.
true
if any Element
has the given class name; otherwise,
false
.
Element.classList.contains() on MDN.
Get the innerHTML
of the first Element
in the collection.
The HTML string of the first Element
.
Element.innerHTML on MDN.
Set the innerHTML
of each Element
in the collection.
The html string to set.
Returns the current collection.
Element.innerHTML on MDN.
Determines whether an array includes a certain element, returning true or false as appropriate.
The element to search for.
Optional
fromIndex: numberThe position in this array at which to begin searching for searchElement.
Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
The value to locate in the array.
Optional
fromIndex: numberThe array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.
Adds all the elements of an array into a string, separated by the specified separator string.
Optional
separator: stringA string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.
Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present.
The value to locate in the array.
Optional
fromIndex: numberThe array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array.
Calls a defined callback function on each element of an array, and returns an array that contains the results.
A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
Optional
thisArg: anyAn object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
Check any Element
in the collection that matches selectors.
One or more selectors to match.
true
if any Element
matches the given selectors; otherwise,
false
.
Element.matches() on MDN.
DOMException
Throws a SyntaxError
if the syntax of the specified selectors
is not
valid.
Optional
options: boolean | EventListenerOptionsOptional
options: boolean | AddEventListenerOptionsInsert a set of Node
or DOMString
objects before the first child of
each ParentNode
in the collection. DOMString
objects are inserted as
equivalent Text
nodes.
Rest
...nodes: (string | Node)[]A set of Node
or DOMString
objects to insert.
The current collection.
new EagleJS(element).prepend('text');
new EagleJS(element).prepend(Node);
new EagleJS(element).prepend('text', Node);
new EagleJS(element).prepend(Node, Node);
ParentNode.prepend() on MDN.
Add one or more items to the end of the collection.
Rest
...items: EventTarget[]Items to add to the end of the collection.
The new length.
new EagleJS(element).push(EventTarget, EventTarget, EventTarget);
// Spread and push
new EagleJS(element).push(...EagleJS);
Array.prototype.push() on MDN.
Get the first Element
descendant of each ParentNode
in the collection
that matches selectors.
One or more selectors to match.
A new collection of Element
s.
ParentNode.querySelector() on MDN.
DOMException
Throws a SyntaxError
if the syntax of the specified selectors
is not
valid.
Get all Element
descendants of each ParentNode
in the collection that
matches selectors.
One or more selectors to match.
A new collection of Element
s.
ParentNode.querySelectorAll() on MDN.
DOMException
Throws a SyntaxError
if the syntax of the specified selectors
is not
valid.
Specify a function to execute when the DOM is completely loaded.
The handler function for the event.
The current collection.
DOMContentLoaded event on MDN.
Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
Remove each ChildNode
of the collection from the DOM.
The current collection.
ChildNode.remove() on MDN.
Remove one or more attributes from each Element
in the collection.
Rest
...names: string[]One or more attribute names.
The current collection.
new EagleJS(element).removeAttr('attributeName');
new EagleJS(element).removeAttr('attributeName', 'attributeName');
Element.removeAttribute() on MDN.
Remove one or more class names from each Element
in the collection.
Rest
...names: string[]One or more class names.
The current collection.
new EagleJS(element).removeClass('className');
new EagleJS(element).removeClass('className', 'className');
Element.classList.remove() on MDN.
DOMException
Throws a SyntaxError
if one of the arguments is the empty string.
DOMException
Throws an InvalidCharacterError
if one of the arguments contains any
ASCII whitespace.
Replace each ChildNode
in the collection with a set of Node
or
DOMString
objects. DOMString
objects are inserted as equivalent Text
nodes.
Rest
...nodes: (string | Node)[]A set of Node
or DOMString
objects to replace.
The current collection.
new EagleJS(element).replaceWith('text');
new EagleJS(element).replaceWith(Node);
new EagleJS(element).replaceWith('text', Node);
new EagleJS(element).replaceWith(Node, Node);
ChildNode.replaceWith() on MDN.
Determines whether the specified callback function returns true for any element of an array.
A function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array.
Optional
thisArg: anyAn object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
Sorts an array in place. This method mutates the array and returns a reference to the same array.
Optional
compareFn: ((a: EventTarget, b: EventTarget) => number)Function used to determine the order of the elements. It is expected to return a negative value if the first argument is less than the second argument, zero if they're equal, and a positive value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
[11,2,22,1].sort((a, b) => a - b)
Get the textContent
of the first Node
in the collection.
Text of the first Node
.
Node.textContent on MDN.
Set the textContent
of each Node
in the collection.
The text to set.
Returns the current collection.
Node.textContent on MDN.
Toggle the attribute to each Element
in the collection.
The name of the attribute.
Optional
force: booleanA boolean value to determine whether the attribute should be added or removed.
The current collection.
new EagleJS(element).toggleAttr('attributeName');
new EagleJS(element).toggleAttr('attributeName', true);
new EagleJS(element).toggleAttr('attributeName', false);
Element.toggleAttribute() on MDN.
Toggle the class name to each Element
in the collection.
The class name to toggle.
Optional
force: booleanA boolean value to determine whether the class should be added or removed.
The current collection.
new EagleJS(element).toggleClass('className');
new EagleJS(element).toggleClass('className', true);
new EagleJS(element).toggleClass('className', false);
Element.classList.toggle() on MDN.
DOMException
Throws a SyntaxError
if one of the arguments is the empty string.
DOMException
Throws an InvalidCharacterError
if one of the arguments contains any
ASCII whitespace.
Returns a string representation of an array. The elements are converted to string using their toLocaleString methods.
Optional
options: NumberFormatOptions & DateTimeFormatOptionsTrigger the specified Event
on each item in the collection.
The Event
object to dispatch.
The current collection.
EventTarget.dispatchEvent() on MDN.
Add one or more items to the beginning of the collection.
Rest
...items: EventTarget[]Items to add to the front of the collection.
The new length.
new EagleJS(element).unshift(EventTarget, EventTarget, EventTarget);
// Spread and unshift
new EagleJS(element).unshift(...EagleJS);
Array.prototype.unshift() on MDN.
Static
fromCreates an array from an array-like object.
An array-like object to convert to an array.
Creates an array from an iterable object.
Creates an array from an iterable object.
Creates an array from an iterable object.
Static
isStatic
isStatic
of
EagleJS.