Class Index | File Index

Classes


Namespace BTM.DOM

Funtionality for selecting, traversing, reading, modifying and creating DOM elements
Defined in: dom.js.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
Field Summary
Field Attributes Field Name and Description
<static>  
The number used for generating new IDs to identify anonymous elements.
<static>  
Attributes specific to each element type
<static>  
BTM.DOM.inlineElements
Tag names for inline HTML Elements
<static>  
CSS properties that are lengths
<static>  
BTM.DOM.pixelRegEx
Regular Expression used to identify a pixel length value
<static>  
Valid attribute names for any element
Method Summary
Method Attributes Method Name and Description
<static>  
BTM.DOM.$(selector)
Lookup an element by ID
<static>  
BTM.DOM.$$(selector, context)
Lookup multiple elements by CSS selector.
<static>  
BTM.DOM.addClass(element, className)
Add a class to an element
<static>  
BTM.DOM.createElement(tag, attributes, content)
Create a new element, optionally with attributes
<static>  
BTM.DOM.getAttribute(element, name)
Get the specified attribute(s) for an element
<static>  
BTM.DOM.getAvailableSpace(element, dimensions)
Get the inner "available" space of an element
<static>  
BTM.DOM.getComputedStyle(element, styleProperty)
Get computed style values for an element
<static>  
BTM.DOM.getDimensions(element, includeMargins)
Get the dimensions of an element, optionally including it's margins
<static>  
BTM.DOM.getPixelValue(element, value)
Get a Pixel value for a non-pixel length type, such as em, pt, etc
<static>  
BTM.DOM.getStyle(element, styleProperty)
Get actual style values for an element
<static>  
BTM.DOM.hasAttribute(element, name)
Check if an element has an attribute
<static>  
BTM.DOM.hasClass(element, className)
Check if an element has a class
<static>  
BTM.DOM.identify(element)
Get a unique reference to an element - returns existing ID if exists, if not applies and returns new, unique ID.
<static>  
BTM.DOM.makeSelectable(element)
Make an element selectable by the user
<static>  
BTM.DOM.makeUnselectable(element)
Make an element unselectable by the user
<static>  
BTM.DOM.morph(element, newTag, options)
Transform an element into a different element, keeping the same attributes
<static>  
BTM.DOM.removeAttribute(element, name)
Remove attribute(s) from an element
<static>  
BTM.DOM.removeClass(element, className)
Remove a class from an element
<static>  
BTM.DOM.setAttribute(element, name, value)
Set attribute(s) on an element
<static>  
BTM.DOM.setStyle(element, name, value)
Set style attribute(s) on an element
<static>  
BTM.DOM.swapClass(element, className1, className2)
Swap between two classes on an element
<static>  
BTM.DOM.update(element, content)
Update the contents of an Element
<static>  
BTM.DOM.wrap(element, newTag, attributes)
Wrap an element in a new element
Namespace Detail
BTM.DOM
Field Detail
<static> BTM.DOM.anonymousElements
The number used for generating new IDs to identify anonymous elements.
See:
BTM.DOM.identify

<static> BTM.DOM.conditionalAttributes
Attributes specific to each element type

<static> BTM.DOM.inlineElements
Tag names for inline HTML Elements

<static> {String[]} BTM.DOM.lengthProperties
CSS properties that are lengths

<static> {RegExp} BTM.DOM.pixelRegEx
Regular Expression used to identify a pixel length value

<static> BTM.DOM.standardAttributes
Valid attribute names for any element
Method Detail
<static> {HTMLElement|Boolean} BTM.DOM.$(selector)
Lookup an element by ID
Parameters:
{HTMLElement|String} selector
element ID or element reference
Returns:
{HTMLElement|Boolean} reference to the element or false if not found

<static> {HTMLElement[]} BTM.DOM.$$(selector, context)
Lookup multiple elements by CSS selector. This will always try to make use of the querySelector API if the browser supports it natively.
If the native method exists but throws an exception (e.g.: MSIE8 using a CSS3 selector) the emulated functionality provided by an external library is used.
Parameters:
{String} selector
CSS selector string
context
Returns:
{HTMLElement[]} elements matching the given CSS Selector
See:
http://www.w3.org/TR/css3-selectors/
http://dev.w3.org/2006/webapi/selectors-api/

<static> {HTMLElement} BTM.DOM.addClass(element, className)
Add a class to an element
Parameters:
{HTMLElement|String} element
element ID or element reference to add class to
{String} className
class to add to the element
Returns:
{HTMLElement} the original element

<static> {HTMLElement} BTM.DOM.createElement(tag, attributes, content)
Create a new element, optionally with attributes
Parameters:
{String} tag
of the new element to create
{Object} attributes Optional
the attributes to add to the newly created element
content
Returns:
{HTMLElement} the newly created element

<static> {String|String[]} BTM.DOM.getAttribute(element, name)
Get the specified attribute(s) for an element
Parameters:
{HTMLElement|String} element
element ID or element reference to get attribute(s) of
{String|String[]} name
the name of a single attribute to get, or an Array containing names of attributes to set
Returns:
{String|String[]} the attribute value(s) from the element.

<static> {Object} BTM.DOM.getAvailableSpace(element, dimensions)
Get the inner "available" space of an element
Parameters:
{HTMLElement|String} element
element ID or element reference to get "available" space of
{Object} dimensions Optional
manual stipulation of the original dimensions to base the calculations on
Returns:
{Object} Object containing "height" and "width" properties.

<static> {String} BTM.DOM.getComputedStyle(element, styleProperty)
Get computed style values for an element
Parameters:
{HTMLElement|String} element
element ID or element reference to get style values from
{String} styleProperty
style property to get from element
Returns:
{String} the computed value of the specified style on element

<static> {Object} BTM.DOM.getDimensions(element, includeMargins)
Get the dimensions of an element, optionally including it's margins
Parameters:
{HTMLElement|String} element
element ID or element reference to get dimensions of
{Boolean} includeMargins Optional, Default: false
flag to include margin width in dimension calculations
Returns:
{Object} Object containing "height" and "width" properties.

<static> {Number|String} BTM.DOM.getPixelValue(element, value)
Get a Pixel value for a non-pixel length type, such as em, pt, etc
Parameters:
{HTMLElement|String} element
element ID or element reference to get pixel value from
{String} value
the value to extract a pixel value from
Returns:
{Number|String} the calculated pixel value, or the original value provided

<static> {String} BTM.DOM.getStyle(element, styleProperty)
Get actual style values for an element
Parameters:
{HTMLElement|String} element
element ID or element reference to get style values from
{String} styleProperty
style property to get from element
Returns:
{String} the value of the specified style on element

<static> {Boolean} BTM.DOM.hasAttribute(element, name)
Check if an element has an attribute
Parameters:
{HTMLElement|String} element
element ID or element reference to check for attribute
{String} name
the name of the attribute to check for
Returns:
{Boolean} true if element has the attribute, false if it does not

<static> {Boolean} BTM.DOM.hasClass(element, className)
Check if an element has a class
Parameters:
{HTMLElement|String} element
element ID or element reference to check for class
{String} className
class to check for
Returns:
{Boolean} true if element has class, false if it does not

<static> {String} BTM.DOM.identify(element)
Get a unique reference to an element - returns existing ID if exists, if not applies and returns new, unique ID.
Parameters:
element
Returns:
{String} the elements ID

<static> {HTMLElement} BTM.DOM.makeSelectable(element)
Make an element selectable by the user
Parameters:
{HTMLElement|String} element
element ID or element reference to make selectable
Returns:
{HTMLElement} the original element
See:
BTM.DOM.makeUnselectable

<static> {HTMLElement} BTM.DOM.makeUnselectable(element)
Make an element unselectable by the user
Parameters:
{HTMLElement|String} element
element ID or element reference to make unselectable
Returns:
{HTMLElement} the original element
See:
BTM.DOM.makeSelectable

<static> {HTMLElement} BTM.DOM.morph(element, newTag, options)
Transform an element into a different element, keeping the same attributes
Parameters:
{HTMLElement|String} element
element ID or element reference to transform
{String} newTag
the tag the element should be to be transformed into
{Object} options Optional
currently un-used
Returns:
{HTMLElement} a reference to the new object

<static> {HTMLElement} BTM.DOM.removeAttribute(element, name)
Remove attribute(s) from an element
Parameters:
{HTMLElement|String} element
element ID or element reference to remove attribute(s) from
{String|Array} name
the name of a single attribute to remove, or an array containing names of attributes to remove
Returns:
{HTMLElement} the original element

<static> {HTMLElement} BTM.DOM.removeClass(element, className)
Remove a class from an element
Parameters:
{HTMLElement|String} element
element ID or element reference to remove class from
{String} className
class to remove from the element
Returns:
{HTMLElement} the original element

<static> {HTMLElement} BTM.DOM.setAttribute(element, name, value)
Set attribute(s) on an element
Parameters:
{HTMLElement|String} element
element ID or element reference to set attribute(s) on
{String|Object} name
the name of a single attribute to set, or an object containing name:value pairs of attributes to set
value Optional
the value to use when setting a single attribute
Returns:
{HTMLElement} the original element

<static> {HTMLElement} BTM.DOM.setStyle(element, name, value)
Set style attribute(s) on an element
Parameters:
{HTMLElement|String} element
element ID or element reference to set style attribute(s) on
{String|Object} name
the name of a single style attribute to set, or an object containing name:value pairs of style attributes to set
value Optional
the value to use when setting a single style attribute
Returns:
{HTMLElement} the original element

<static> {HTMLElement} BTM.DOM.swapClass(element, className1, className2)
Swap between two classes on an element
Parameters:
{HTMLElement|String} element
element ID or element reference to toggle classes of
{String} className1
first class to toggle between
{String} className2 Optional, Default: ""
second class to toggle between.
Returns:
{HTMLElement} the original element

<static> {HTMLElement} BTM.DOM.update(element, content)
Update the contents of an Element
Parameters:
{HTMLElement|String} element
element ID or element reference to update contents of
{HTMLElement|Object|String} content
the new content for the element. Can be a HTML Element, a string, or an object (requires a toHTML or toString method)
Returns:
{HTMLElement} the original Element

<static> {HTMLElement} BTM.DOM.wrap(element, newTag, attributes)
Wrap an element in a new element
Parameters:
{HTMLElement|String} element
element ID or element reference to wrap
{String} newTag
tag to wrap original element with
{Object} attributes Optional
attributes to set on new element
Returns:
{HTMLElement} the newly created element

Documentation generated by JsDoc Toolkit 2.1.0 on Tue Feb 03 2009 04:12:53 GMT+1100 (EST)