Class Sfdc.canvas
Canvas
Defined in: canvas.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
<static> |
Sfdc.canvas.attr(el, name)
Returns the value for the given attribute name on the given DOM element.
|
<static> |
Sfdc.canvas.byClass(clazz)
Returns a set of DOM elements in the current document with the given class names
|
<static> |
Sfdc.canvas.byId(id)
Returns the DOM element in the current document with the given ID
|
<static> |
Sfdc.canvas.each(obj, it, ctx)
Calls a defined function for each element in an object
|
<static> |
Sfdc.canvas.extend(dest, mixin1-n)
Adds the contents of 2 or more objets to
a destination object.
|
<static> |
Sfdc.canvas.hasOwn(obj, prop)
Checks whether an object contains an uninherited property.
|
<static> |
Sfdc.canvas.identity(obj)
This function always returns the argument.
|
<static> |
Sfdc.canvas.indexOf(array, item)
Calculates the location of an element in an array.
|
<static> |
Sfdc.canvas.invoker(fn)
This function runs the function that is passed to it.
|
<static> |
Sfdc.canvas.isArguments(value)
Checks whether an object is the argument set for a function
|
<static> |
Sfdc.canvas.isArray(value)
Checks whether an object is an array.
|
<static> |
Sfdc.canvas.isFunction(value)
Checks whether an object is a function.
|
<static> |
Sfdc.canvas.isNil(value)
Checks whether object is undefined, null, or an empty string.
|
<static> |
Sfdc.canvas.isNumber(value)
Checks whether a value is a number.
|
<static> |
Sfdc.canvas.isObject(value)
Checks whether the value is of type 'object' and is not null.
|
<static> |
Sfdc.canvas.isUndefined(value)
Checks whether an object is currently undefined.
|
<static> |
Sfdc.canvas.map(obj, it, ctx)
Creates a new array with the results of calling the
function on each element in the object.
|
<static> |
Sfdc.canvas.module(ns, decl)
Adds a module to the global.Sfdc.canvas object
|
<static> |
Sfdc.canvas.nop()
An empty or blank function.
|
Of(obj)
Returns the prototype of the specified object
|
|
<static> |
Sfdc.canvas.onReady(The)
register a callback to be called after the DOM is ready.
|
<static> |
Sfdc.canvas.param(a, encode)
Serializes an object into a string that can be used as a URL query string.
|
<static> |
Sfdc.canvas.query(url, q)
append the query string to the end of the URL, and strip off any existing Hash tag
|
<static> |
Sfdc.canvas.remove(array, item)
Removes an element from an array.
|
<static> |
Sfdc.canvas.size(obj)
Calculates the number of elements in an object
|
<static> |
Sfdc.canvas.slice(array, begin, end)
Creates a new array containing the selected elements of the given array.
|
<static> |
Sfdc.canvas.stripUrl(url)
Strip out the URL to just the {scheme}://{host}:{port} - remove any path and query string information.
|
<static> |
Sfdc.canvas.toArray(iterable)
Creates an array from an object.
|
<static> |
Sfdc.canvas.values(obj)
Creates an array containing all the elements of the given object
|
Method Detail
<static>
{String}
Sfdc.canvas.attr(el, name)
Returns the value for the given attribute name on the given DOM element.
- Parameters:
- {DOMElement} el
- The element on which to check the attribute.
- {String} name
- The name of the attribute for which to find a value
- Returns:
- {String} The given attribute's value.
<static>
{Array}
Sfdc.canvas.byClass(clazz)
Returns a set of DOM elements in the current document with the given class names
- Parameters:
- {String} clazz
- The class names to find in the DOM. Multiple classnames can be given, separated by whitespace
- Returns:
- {Array} Set of DOM elements that all have the given class name
<static>
{DOMElement}
Sfdc.canvas.byId(id)
Returns the DOM element in the current document with the given ID
- Parameters:
- {String} id
- The id to find in the DOM
- Returns:
- {DOMElement} The DOM element with the given ID, null if the element does not exist.
<static>
Sfdc.canvas.each(obj, it, ctx)
Calls a defined function for each element in an object
- Parameters:
- {Object} obj
- The object to loop through. It can be an array, an array like object or a map of properties
- {Function} it
- The callback function to run for each element.
- {Object} ctx Optional
- The context object to be used for the callback function. Defaults to the original object if not provided.
<static>
{Object}
Sfdc.canvas.extend(dest, mixin1-n)
Adds the contents of 2 or more objets to
a destination object.
- Parameters:
- {Object} dest
- The destination object to modify.
- {Object} mixin1-n
- An unlimited number of objects to add to the destination.
- Returns:
- {Object} The modified destination object.
<static>
{Boolean}
Sfdc.canvas.hasOwn(obj, prop)
Checks whether an object contains an uninherited property.
- Parameters:
- {Object} obj
- The object to check
- {String} prop
- The property name to check
- Returns:
- {Boolean}
true
if the property exists for the object itself and is not inherited, otherwisefalse
<static>
{Object}
Sfdc.canvas.identity(obj)
This function always returns the argument.
- Parameters:
- {Object} obj
- The object to return, untouched.
- Returns:
- {Object} The argument used for this function call.
<static>
{Integer}
Sfdc.canvas.indexOf(array, item)
Calculates the location of an element in an array.
- Parameters:
- {Array} array
- The array to check.
- {Object} item
- The item to search for within the array.
- Returns:
- {Integer} The index of the element within the array. Returns -1 if the element is not found.
<static>
Sfdc.canvas.invoker(fn)
This function runs the function that is passed to it.
- Parameters:
- {Function} fn
- The function to run
<static>
{Boolean}
Sfdc.canvas.isArguments(value)
Checks whether an object is the argument set for a function
- Parameters:
- {Object} value
- The object to check
- Returns:
- {Boolean}
true
if the object or value is the argument set for a function, otherwisefalse
<static>
{Boolean}
Sfdc.canvas.isArray(value)
Checks whether an object is an array.
- Parameters:
- {Object} value
- The object to check
- Returns:
- {Boolean}
true
if the object or value is of type array, otherwisefalse
<static>
{Boolean}
Sfdc.canvas.isFunction(value)
Checks whether an object is a function.
- Parameters:
- {Object} value
- Object to check
- Returns:
- {Boolean}
true
if the object or value is a function, otherwisefalse
<static>
{Boolean}
Sfdc.canvas.isNil(value)
Checks whether object is undefined, null, or an empty string.
- Parameters:
- {Object} value
- The object to check
- Returns:
- {Boolean}
true
if the object or value is of type undefined, otherwisefalse
<static>
{Boolean}
Sfdc.canvas.isNumber(value)
Checks whether a value is a number. This function doesn't resolve strings to numbers.
- Parameters:
- {Object} value
- Object to check
- Returns:
- {Boolean}
true
if the object or value is a number, otherwisefalse
<static>
{Boolean}
Sfdc.canvas.isObject(value)
Checks whether the value is of type 'object' and is not null.
- Parameters:
- {Object} value
- The object to check
- Returns:
- {Boolean}
true
if the object or value is of type Object, otherwisefalse
<static>
{Boolean}
Sfdc.canvas.isUndefined(value)
Checks whether an object is currently undefined.
- Parameters:
- {Object} value
- The object to check
- Returns:
- {Boolean}
true
if the object or value is of type undefined, otherwisefalse
<static>
{Array}
Sfdc.canvas.map(obj, it, ctx)
Creates a new array with the results of calling the
function on each element in the object.
- Parameters:
- {Object} obj
- The object to use.
- {Function} it
- The callback function to run for each element.
- {Object} ctx Optional
- The context object to be used for the callback function. Defaults to the original object if not provided.
- Returns:
- {Array} The array that results when calling the function on each element in the object.
<static>
{Object}
Sfdc.canvas.module(ns, decl)
Adds a module to the global.Sfdc.canvas object
- Parameters:
- {String} ns
- The namespace for the new module.
- decl
- Returns:
- {Object} The global.Sfdc.canvas object with a new module added.
<static>
Sfdc.canvas.nop()
An empty or blank function.
{Object}
Of(obj)
Returns the prototype of the specified object
- Parameters:
- {Object} obj
- The object for which to find the prototype.
- Returns:
- {Object} The object that is the prototype of the given object.
<static>
Sfdc.canvas.onReady(The)
register a callback to be called after the DOM is ready.
onReady.
- Parameters:
- {Function} The
- callback function to be called.
<static>
{String}
Sfdc.canvas.param(a, encode)
Serializes an object into a string that can be used as a URL query string.
- Parameters:
- {Object|Array} a
- The array or object to serialize.
- {Boolean} encode Optional, Default: false
- Indicates that the string should be encoded.
- Returns:
- {String} A string representing the object as a URL query string.
<static>
Sfdc.canvas.query(url, q)
append the query string to the end of the URL, and strip off any existing Hash tag
- Parameters:
- {String} url
- The url to be appended to
- q
- Returns:
- uel with query string appended..
<static>
Sfdc.canvas.remove(array, item)
Removes an element from an array.
- Parameters:
- {Array} array
- The array to modify.
- {Object} item
- The element to remove from the array.
<static>
{Integer}
Sfdc.canvas.size(obj)
Calculates the number of elements in an object
- Parameters:
- {Object} obj
- The object to size.
- Returns:
- {Integer} The number of elements in the object.
<static>
{Array}
Sfdc.canvas.slice(array, begin, end)
Creates a new array containing the selected elements of the given array.
- Parameters:
- {Array} array
- The array to subset.
- {Integer} begin Optional, Default: 0
- The index that specifies where to start the selection.
- {Integer} end Optional, Default: array.length
- The index that specifies where to end the selection.
- Returns:
- {Array} A new array that contains the selected elements.
<static>
{String}
Sfdc.canvas.stripUrl(url)
Strip out the URL to just the {scheme}://{host}:{port} - remove any path and query string information.
- Parameters:
- {String} url
- The url to be stripped
- Returns:
- {String} just the {scheme}://{host}:{port} portion of the url.
<static>
{Array}
Sfdc.canvas.toArray(iterable)
Creates an array from an object.
- Parameters:
- {Object} iterable
- The object to use in creating the array.
- Returns:
- {Array} The new array created from the object.
<static>
{Array}
Sfdc.canvas.values(obj)
Creates an array containing all the elements of the given object
- Parameters:
- {Object} obj
- The object the use in creating the array
- Returns:
- {Array} An array containing all the elements in the object.