Utilities - Appendices - Web Development with jQuery (2015)

Web Development with jQuery (2015)

Part IV. Appendices

Appendix I. Utilities

Method/Property

Description

Return Value

$.clearQueue([queue])

Removes from the queue all items that have not yet been executed.

jQuery

$.contains(
container,
contained
)

Determines whether a DOM element is a descendant of another DOM element.

Boolean

$.dequeue(element
[, queue]
)

Executes the next function in the queue for the matched element.

Undefined

$.extend(
target
[, object1]
[, . . .]
)

Extends the target object with one or more specified objects.

Object

$.extend(
[ deep,]
target
[, object1]
[, . . .]
)

Extends the target object with one or more specified objects. If the optional deep argument is true, then the objects are merged recursively (aka deep copy).

Object

$.fn.extend(object)

Merges an object into jQuery itself. This is used, for example, to create jQuery plugins.

Object

$.globalEval(code)

Executes the specified JavaScript code in the global scope.

Undefined

$.grep(
array,
function()
[, invert]
)

Filters items out of an array using a callback function. If the optional invert argument is false or not provided, grep returns an array of items where the callback function has returned true for each of those items. If the invertargument is true, it returns an array where the callback function for each item has returned false.

Array

$.inArray(value, array
[, fromIndex]
)

Determines whether the specified value appears in the specified array, optionally starting at the offset provided to the fromIndex argument (counting from zero).

Array

$.isArray(array)

Determines if the item provided is an array.

Boolean

$.isEmptyObject(object)

Determines whether the item provided is an empty object.

Boolean

$.isFunction(object)

Determines whether the item provided is a function.

Boolean

$.isNumeric(value)

Determines whether the item provided is numeric.

Boolean

$.isPlainObject(object)

Determines whether the item provided is a plain object.

Boolean

$.isWindow(object)

Determines whether the item provided is a Window.

Boolean

$.isXMLDoc(node)

Determines whether the item provided is an XML document.

Boolean

$.makeArray(object)

Turns anything into an array (instead of an Object or a StaticNodeList).

Array

$.merge(array1, array2)

Merges two arrays into one.

Array

$.noop()

An empty function, use this function reference if you want a function that does nothing.

Undefined

$.now()

Returns a number representing the current time. The number returned is a shorthand for:
(new Date).getTime()

Number

$.parseHTML(html)

Parses an HTML string into an array of DOM nodes.

Array

$.parseJSON(json)

Parses a JSON string and returns the resulting JavaScript object.

Object

$.parseXML(xml)

Parses an XML string into an XML document.

XMLDocument

$.proxy(
function(),
context
[, arguments]
)

Takes a function and returns a new one with the provided context. this becomes what you provide to context.
If the arguments argument is specified, those arguments will be sent on to the function.

Function

$.proxy(
context,
functionName
[, arguments]
)

Takes a function and returns a new one with the provided context. this becomes what you provide to context.
functionName is a string referencing the function you want to change the context of.
If the arguments argument is specified, those arguments will be sent on to the function.

Function

$.queue(element[, queue])

Shows the queue of functions to be executed on the element.

Array

$.support()

Returns an object containing properties that describe the browser's features or bugs for jQuery's internal use.

Object

$.trim(string)

Removes white space (newline characters, spaces, tabs, and carriage returns) from the beginning and end of a string.

String

$.type(object)

Determines the internal JavaScript class of an object.

String

$.unique(array)

Removes duplicate values from the specified array.

Array