Return a collection of given items.
Items to add to the collection.
Readonly[unscopables]Is an object whose properties have the value 'true' when they will be absent when used in a 'with' statement.
Optional[iterator]?: booleanOptional Readonly[unscopables]?: booleanIs an object whose properties have the value 'true' when they will be absent when used in a 'with' statement.
Optionalconcat?: booleanOptionalcopyWithin?: booleanOptionalentries?: booleanOptionalevery?: booleanOptionalfill?: booleanOptionalfilter?: booleanOptionalfind?: booleanOptionalfindIndex?: booleanOptionalforEach?: booleanOptionalincludes?: booleanOptionalindexOf?: booleanOptionaljoin?: booleanOptionalkeys?: booleanOptionallastIndexOf?: booleanOptionallength?: booleanGets or sets the length of the array. This is a number one higher than the highest index in the array.
Optionalmap?: booleanOptionalpop?: booleanOptionalpush?: booleanOptionalreduce?: booleanOptionalreduceRight?: booleanOptionalreverse?: booleanOptionalshift?: booleanOptionalslice?: booleanOptionalsome?: booleanOptionalsort?: booleanOptionalsplice?: booleanOptionaltoLocaleString?: booleanOptionaltoString?: booleanOptionalunshift?: booleanOptionalvalues?: booleanGets or sets the length of the array. This is a number one higher than the highest index in the array.
Static Readonly[species]Iterator
Add one or more class names to each Element in the collection.
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.
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.
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.
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 Nodes.
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 Elements.
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.
Optionalend: 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.
Returns an iterable of key, value pairs for every entry in the array
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.
OptionalthisArg: 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.
OptionalthisArg: 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
Optionalstart: 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.
Optionalend: numberindex to stop filling the array at. If end is negative, it is treated as length+end.
Returns the items of a collection that meet the condition specified in a callback function.
A function that accepts up to three arguments. The filter method calls the predicate function one time for each item in the collection.
OptionalthisArg: unknownAn object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
A shallow copy of the given collection containing just the items that pass the test. If no items pass the test, an empty collection is returned.
Array.prototype.filter() on MDN.
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.
OptionalthisArg: anyIf provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.
OptionalthisArg: 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.
OptionalthisArg: 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.
OptionalthisArg: 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.
OptionalfromIndex: 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.
OptionalfromIndex: 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.
Optionalseparator: 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 an iterable of keys in the array
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.
OptionalfromIndex: 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.
OptionalthisArg: 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.
Removes the last element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.
Insert 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.
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.
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 Elements.
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 Elements.
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.
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.
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.
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.
Reverses the items in a collection in place. This method mutates the collection and returns a reference to the same collection.
The current collection.
Array.prototype.reverse() on MDN.
Removes the first element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.
Returns a copy of a section of a collection. For both start and end, a negative index can be used to indicate an offset from the end of the collection.
Optionalstart: numberThe beginning index of the specified portion of the collection. If start is undefined, then the slice begins at index 0.
Optionalend: numberThe end index of the specified portion of the collection. This is exclusive of the element at the index 'end'. If end is undefined, then the slice extends to the end of the collection.
A new collection containing the extracted items.
Array.prototype.slice() 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.
OptionalthisArg: 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.
OptionalcompareFn: (a: EventTarget, b: EventTarget) => numberFunction 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, UTF-16 code unit order.
[11,2,22,1].sort((a, b) => a - b)
Removes item from a collection and, if necessary, inserts new items in their place, returning the deleted items.
The zero-based location in the collection from which to start removing items.
OptionaldeleteCount: numberThe number of items to remove.
Items to insert into the collection in place of the deleted items.
A new collection containing the items that were deleted.
Array.prototype.splice() on MDN.
Toggle the attribute to each Element in the collection.
The name of the attribute.
Optionalforce: 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.
Optionalforce: 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.
Optionaloptions: NumberFormatOptions & DateTimeFormatOptionsReturns a string representation of an array.
Trigger 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.
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.
Returns an iterable of values in the array
StaticfromStaticisStaticisChecks if the given value is an instance of EventTarget.
The value to be checked.
true if the given value is an instance of EventTarget;
otherwise, false.
Staticof
EagleJS.