A JavaScript and DOM utility library.
For the sake of time and brevity:
- DOM Elements, Nodes = Node
- DOM NodeLists, HTMLCollections, Array-like objects = ArrayLike, Array-like
- gg factory objects = GObject
- contents of iterables = item, element
- gg
- typeOf
- arrSlice
- isArray
- isBoolean
- isFunction
- isNull
- isNumber
- isObject
- isString
- isUndefined
- isArrayLike
- isBuffer
- isEmpty
- isGG
- isNan
- isNode
- isTypedArray
- toArray
- toCamelCase
- toCodesFromString
- toFloat
- toHyphenated
- toInt
- toUint8
- toBuffer
- toStringFromCodes
- betterview
- copy
- each
- emitter
- equal
- extend
- inherits
- inArray
- noop
- supplant
- uuid
- getPosition
- getStyle
- setImmediate
- getById
- select
- selectAll
- scrollIntoView
- scrollToTop
- create
- keyboardListener
- mouseListener
- removeKeyboardListeners
- removeMouseListeners
- ease
- cdb
- gobject
Return a collection of matched nodes found in the DOM.
Name | Type | Description |
---|---|---|
selector | String, Node, ArrayLike, GObject | The value containing a string, selector expression, a Node, an Array-like, or a gobject. |
supplanter | Object (optional) | The value to supplant into the selector. |
Determines the type of its argument.
Name | Type | Description |
---|---|---|
value | Any | The value to be tested. |
Shorthand for Array.prototype.slice.call.
Name | Type | Description |
---|---|---|
value | Any | The "this" value for Array.prototype.slice. |
start | Number (optional) | An integer that specifies where to start the selection (The first element has an index of 0). Use negative numbers to select from the end of an array. If omitted, it acts like 0. |
end | Number (optional) | An integer that specifies where to end the selection. If omitted, all elements from the start position and to the end of the array will be selected. Use negative numbers to select from the end of an array. |
Determines if its argument is an array.
Name | Type | Description |
---|---|---|
value | Any | The value to be tested. |
Determines if its argument is a boolean.
Name | Type | Description |
---|---|---|
value | Any | The value to be tested. |
Determines if its argument is a function.
Name | Type | Description |
---|---|---|
value | Any | The value to be tested. |
Determines if its argument is null.
Name | Type | Description |
---|---|---|
value | Any | The value to be tested. |
Determines if its argument is a number.
Name | Type | Description |
---|---|---|
value | Any | The value to be tested. |
Determines if its argument is an object.
Name | Type | Description |
---|---|---|
value | Any | The value to be tested. |
Determines if its argument is a string.
Name | Type | Description |
---|---|---|
value | Any | The value to be tested. |
Determines if its argument is undefined.
Name | Type | Description |
---|---|---|
value | Any | The value to be tested. |
Determines if its argument is array-like.
Name | Type | Description |
---|---|---|
value | Any | The value to be tested. |
Determines if its argument is an arraybuffer.
Name | Type | Description |
---|---|---|
value | Any | The value to be tested. |
Determines if its argument is an object with no enumerable properties.
Name | Type | Description |
---|---|---|
value | Any | The value to be tested. |
Determines if its argument is a gobject.
Name | Type | Description |
---|---|---|
value | Any | The value to be tested. |
Determines if its argument is NaN.
Name | Type | Description |
---|---|---|
value | Any | The value to be tested. |
Determines if its argument is a node.
Name | Type | Description |
---|---|---|
value | Any | The value to be tested. |
Determines if its argument is a TypedArray.
Name | Type | Description |
---|---|---|
value | Any | The value to be tested. |
Converts its argument to an Array.
Name | Type | Description |
---|---|---|
value | Any | The value to be converted. |
Converts a hyphenated string to camel case. Returns false if its argument is not a string.
Name | Type | Description |
---|---|---|
value | String | The value to be converted. |
Converts a string to an array of Unicodes. Its argument is first passed through toArray.
Name | Type | Description |
---|---|---|
value | String | The value to be converted. |
Converts a value to a floating point number with an optional number of decimals. Removes commas before conversion and returns 0 if its result is NaN.
Name | Type | Description |
---|---|---|
value | String, Number | The value to be converted. |
decimals | Number (optional) | The number of decimals. |
Converts a camel case string to a hyphenated one. Returns false if its argument is not a string.
Name | Type | Description |
---|---|---|
value | String | The value to be converted. |
Converts a value to an integer using the specified radix. Removes commas before conversion and returns 0 if its result is NaN.
Name | Type | Description |
---|---|---|
value | String, Number | The value to be converted. |
radix | Number (optional, default: 10) | The radix to use. |
Converts its argument to an uint8array. If its argument is a number, it returns an uint8array with an equal length.
Name | Type | Description |
---|---|---|
value | Any | The value to be converted. |
Converts its argument to an arraybuffer by passing it through toUint8 and getting its buffer property. If its argument is a number, it returns an arraybuffer with an equal length.
Name | Type | Description |
---|---|---|
value | Any | The value to be converted. |
Converts an array of Unicodes to a string. Its argument is first passed through toArray.
Name | Type | Description |
---|---|---|
value | Array | The value to be converted. |
An upgraded DataView.
Name | Type | Description |
---|---|---|
value | Any | The value passed through toBuffer before storing. |
offset | Number (optional) | The offset, in bytes, to the first byte in the specified buffer for the new view to reference. If not specified, the view of the buffer will start with the first byte. |
length | Number (optional) | The number of elements in the byte array. If unspecified, length of the view will match the buffer's length. |
Copies its argument by value.
Name | Type | Description |
---|---|---|
value | Any | The value to copy. |
Calls a provided function once for each element in a set of elements, in order. It returns the assigned "this" value.
Name | Type | Description |
---|---|---|
items | GObject, Array, ArrayLike, TypedArray, Buffer, Object, Node | The value to iterate over. |
executable | Function | The function to be run for each element within the set. |
thisarg | Any (optional) | The value to be passed to the function to be used as its "this" value. If empty, the iterated set of elements will be assigned to it. |
A client side port of Node.js' events.js. Allows, enables, and returns an emitter object - one able to listen for and emit custom events.
Name | Type | Description |
---|---|---|
value | Object (optional) | The object to turn into an emitter. |
Determines if its two arguments are equal by value.
Name | Type | Description |
---|---|---|
one | Any | A value to compare. |
two | Any | A value to compare. |
Extends its first argument with its second.
Name | Type | Description |
---|---|---|
value | Object | The value to extend. |
add | Object | The extending value. |
overwrite | Boolean (optional; default: true) | The value indicating if values with matching keys will be overwritten. |
Its first argument prototypically inherits from its second.
Name | Type | Description |
---|---|---|
ctor | Function | The inheriting value. |
superCtor | Function | The inherited value. |
Checks if its second argument is contained within its first.
Name | Type | Description |
---|---|---|
list | Array | The value to look through. |
value | Any | The value to look for. |
An empty function.
Does variable substitution on its first argument. It scans through its first argument looking for expressions enclosed in { } braces. If an expression is found, use it as a key on its second argument, and if the key has a string value or number value, it is substituted for the bracket expression and it repeats.
Name | Type | Description |
---|---|---|
value | String | The value to scan. |
supplanter | Object | The supplanting value. |
Generates a universally unique identifier.
Gets its arguments absolute x and y coordinates.
Name | Type | Description |
---|---|---|
node | Node | The Node to get the position of. |
Shorthand for window.getComputedStyle.
Name | Type | Description |
---|---|---|
node | Node | The node to get the computed style of. |
pseudo | String (optional; default: null) | The pseudo-element to get. |
Shorthand for window.setTimeout with 0 wait time.
Name | Type | Description |
---|---|---|
executable | Function | The function that will be run. |
Combines supplant and document.getElementById, in that order.
Name | Type | Description |
---|---|---|
id | String | The value to scan. |
supplanter | Object | The supplanting value. |
Combines document.querySelector and supplant, in that order, where document is replaced by the optional third argument if provided.
Name | Type | Description |
---|---|---|
selector | String | The value to scan. |
supplanter | Object | The supplanting value. |
node | Node | The node to execute the query from. |
Combines document.querySelectorAll and supplant, in that order, where document is replaced by the optional third argument if provided.
Name | Type | Description |
---|---|---|
selector | String | The value to scan. |
supplanter | Object | The supplanting value. |
node | Node | The node to execute the query from. |
Scrolls its first argument into view using its second argument as the easing function.
Name | Type | Description |
---|---|---|
node | Node | The node to scroll into view. |
easingExec | Function (optional, default: ease.easeInOutSine) | The easing function to use when scrolling the page. |
Scrolls to the top of its first argument using its second argument as the easing function.
Name | Type | Description |
---|---|---|
node | Node | The node to scroll to the top of. |
easingExec | Function (optional, default: ease.easeInOutSine) | The easing function to use when scrolling. |
Case insensitive shorthand for document.createElement. The new node is converted to a gobject before being returned. If its argument is not a correctly named node it returns null.
Name | Type | Description |
---|---|---|
tag | String | The name of the node to create. |
Listens for keyboard key down events.
Name | Type | Description |
---|---|---|
options | Object | Each options key is a keyCode (Number, String) of the keyboard key to listen for when pressed down with one exception - "preventDefault": (Boolean). Optionally, five strings are recognized as keys: "enter", "leftarrow", "uparrow", "downarrow", and "rightarrow". Each value is a function to run when its corresponding key is pressed down. |
Listens for mouse key down events.
Name | Type | Description |
---|---|---|
options | Object | Each options key is a button code (Number, String) of the mouse button to listen for when pressed down with one exception - "preventDefault": (Boolean). Optionally, three strings are recognized as keys: "left", "middle", and "right". Each value is a function to run when its corresponding button is pressed down. |
Removes all keyboard listeners.
Removes all mouse listeners.
A collection of easing functions that return a current value based on four parameters.
Name | Type | Description |
---|---|---|
t | Number | The current time. |
b | Number | The initial value. |
c | Number | The change in value. |
d | Number | The total duration. |
- linearTween
- easeInQuad
- easeOutQuad
- easeInOutQuad
- easeInCubic
- easeOutCubic
- easeInOutCubic
- easeInQuart
- easeOutQuart
- easeInOutQuart
- easeInQuint
- easeOutQuint
- easeInOutQuint
- easeInSine
- easeOutSine
- easeInOutSine
- easeInExpo
- easeOutExpo
- easeInOutExpo
- easeInCirc
- easeOutCirc
- easeInOutCirc
An emitter that is a small, SQL-like interface to indexedDB.
Name | Parameters | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
open |
|
Opens a new database. | ||||||||||||
delete |
|
Deletes a database. |
Name | Type | Description |
---|---|---|
open | Event, CDBRequest | Fired when a new database is successfully opened. |
delete-db | Event | Fired when a database is successfully deleted. |
delete-table | String | Fired when an object store is successfully deleted. |
error | Event | Fired when an error occurs. |
A wrapper around an IDBDatabase object.
Name | Parameters | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
database | Returns the unwrapped IDBDatabase object. | |||||||||||||
create |
|
Creates a new object store. | ||||||||||||
delete |
|
Deletes an object store. |
A wrapper around an IDBRequest object.
Name | Parameters | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request | Returns the unwrapped IDBDatabase object. | |||||||||||||
database | Returns the unwrapped IDBDatabase object. | |||||||||||||
select |
|
Gets a value with a given key name at a specified object store. | ||||||||||||
selectAll |
|
Gets appropriate number of values within the given key range or with a given key at a specified object store. | ||||||||||||
selectAllKeys |
|
Gets all keys for all objects in the object store. | ||||||||||||
selectIndex |
|
Gets a value with a given index and key name at a specified object store. | ||||||||||||
delete |
|
Deletes all matched records from a given object store and key or keyRange. | ||||||||||||
insert |
|
Inserts a value with a given key name in a given object store. | ||||||||||||
update |
|
Updates a value with a given key name in a given object store. | ||||||||||||
clear |
|
Removes all records and records in indexes from a given object store. | ||||||||||||
count |
|
Gets the total number of matched records from a given object store. |
A gg factory object.
Adds nodes to the gobject.
Name | Type | Description |
---|---|---|
value | GObject, Array, ArrayLike, Node | The nodes to add. |
Adds a class to all nodes contained within the gobject.
Name | Type | Description |
---|---|---|
value | String | The class to add. |
Places nodes after each node contained within the gobject.
Name | Type | Description |
---|---|---|
value | GObject, Array, ArrayLike, Node | The nodes to place after. |
Appends nodes to each node contained within the gobject.
Name | Type | Description |
---|---|---|
value | GObject, Array, ArrayLike, Node | The nodes to append. |
Appends the nodes contained within the gobject to its argument.
Name | Type | Description |
---|---|---|
value | GObject, Array, ArrayLike, Node | The nodes to append to. |
Sets or gets an attribute on the nodes contained within the gobject.
Name | Type | Description |
---|---|---|
name | String, Object, Array | The attribute name. |
value | String (optional) | The attribute value. |
Places nodes before each node contained within the gobject.
Name | Type | Description |
---|---|---|
value | GObject, Array, ArrayLike, Node | The nodes to place before. |
Gets the children of the nodes contained within the gobject.
Sets or gets the className attribute on the nodes contained within the gobject.
Name | Type | Description |
---|---|---|
value | String (optional) | The className value. |
Clones the nodes contained within the gobject.
Name | Type | Description |
---|---|---|
deep | Boolean (optional, default: false) | Specifies whether all descendants of each node should be cloned. |
deeper | Boolean (optional, default: false) | Specifies whether all event handlers of each node should be cloned. |
Creates a new node and appends it to the original gobject.
Name | Type | Description |
---|---|---|
tag | String | The type of node to be created. |
Sets or gets a data attribute on the nodes contained within the gobject.
Name | Type | Description |
---|---|---|
name | String, Object, Array | The attribute name. |
value | String (optional) | The attribute value. |
Iterates over the nodes contained within the gobject. Every node is wrapped in its own gobject instance before being passed to the executable.
Name | Type | Description |
---|---|---|
executable | Function | The function to pass each node to. |
Iterates over the nodes contained within the gobject. Every node is passed to the executable in its raw form.
Name | Type | Description |
---|---|---|
executable | Function | The function to pass each node to. |
Gets the specified node from within the gobject.
Name | Type | Description |
---|---|---|
index | Number (optional) | The node position within the gobject. |
Determines whether the nodes contained within the gobject have a specified class.
Name | Type | Description |
---|---|---|
value | String | The class to check for. |
Sets or gets the innerHTML attribute on the nodes contained within the gobject.
Name | Type | Description |
---|---|---|
value | String (optional) | The innerHTML value. |
Inserts raw HTML at the specified position relative to each node contained within the gobject.
Name | Type | Description |
---|---|---|
pos | String | The position to place the raw HTML. |
value | String | The raw HTML. |
Gets the number of nodes contained within the gobject.
Removes event handlers from the nodes contained within the gobject.
Name | Type | Description |
---|---|---|
type | String | The name of the event. |
executable | Function (optional) | The specific handler to remove. |
bub | Boolean (optional, default: false) | Determines event bubbling. |
Adds event handlers to the nodes contained within the gobject.
Name | Type | Description |
---|---|---|
type | String | The name of the event. |
executable | Function | The handler to add. |
bub | Boolean (optional, default: false) | Determines event bubbling. |
arg | Any (optional) | The argument to pass to the handler upon execution. |
Adds event handlers to the nodes contained within the gobject. The handler is removed after execution.
Name | Type | Description |
---|---|---|
type | String | The name of the event. |
executable | Function | The handler to add. |
bub | Boolean (optional, default: false) | Determines event bubbling. |
arg | Any (optional) | The argument to pass to the handler upon execution. |
Gets the parents of the nodes contained within the gobject.
Prepends nodes to each node contained within the gobject.
Name | Type | Description |
---|---|---|
value | GObject, Array, ArrayLike, Node | The nodes to prepend. |
Prepends the nodes contained within the gobject to its argument.
Name | Type | Description |
---|---|---|
value | GObject, Array, ArrayLike, Node | The nodes to prepend to. |
Sets or gets properties on the nodes contained within the gobject.
Name | Type | Description |
---|---|---|
name | String, Object, Array | The property name. |
value | String (optional) | The property value. |
Gets the raw value of specified node from within the gobject
Name | Type | Description |
---|---|---|
index | Number (optional) | The node position within the gobject. |
Removes the nodes contained within the gobject or just their specified children.
Name | Type | Description |
---|---|---|
value | GObject, Array, ArrayLike, Node (optional) | The children to remove. |
Removes attributes from the nodes contained within the gobject.
Name | Type | Description |
---|---|---|
name | String, Object, Array | The attribute name. |
Removes classes from the nodes contained within the gobject.
Name | Type | Description |
---|---|---|
value | String | The class to remove. |
Removes data attributes from the nodes contained within the gobject.
Name | Type | Description |
---|---|---|
name | String, Object, Array | The data attribute name. |
Removes the innerHTML from the nodes contained within the gobject.
Removes properties from the nodes contained within the gobject.
Name | Type | Description |
---|---|---|
name | String, Object, Array | The property name. |
Removes the textContent from the nodes contained within the gobject.
Runs querySelector on the nodes contained within a gobject.
Name | Type | Description |
---|---|---|
selector | String | The value to scan. |
supplanter | Object | The supplanting value. |
Runs querySelectorAll on the nodes contained within a gobject.
Name | Type | Description |
---|---|---|
selector | String | The value to scan. |
supplanter | Object | The supplanting value. |
Removes nodes from the gobject.
Name | Type | Description |
---|---|---|
index | Number | The node position within the gobject. |
Sets or gets the textContent attribute on the nodes contained within the gobject.
Name | Type | Description |
---|---|---|
value | String (optional) | The textContent value. |
Toggles a class on the nodes contained within the gobject.
Name | Type | Description |
---|---|---|
value | String | The class to toggle. |