Class DOMUtil

Defined in: DOMUtil.js.
DOMUtil

Utility class with static methods for manipulating the DOM

Class Summary
Constructor Attributes Constructor Name and Description
 
Utility class with static methods for manipulating the DOM
Method Summary
Method Attributes Method Name and Description
<static>  
DOMUtil.addClass(node, newClass)
Adds a CSS class to the passed node
<static>  
DOMUtil.addRowToTable(table, rowData)
<static>  
DOMUtil.applyAttributesToElement(element, attributes)
Creates a HTML password input
<static>  
DOMUtil.checkDOM()
Boots old browsers to the upgrade page
<static>  
DOMUtil.createDefinitionList(values, attributes)
<static>  
DOMUtil.createElement(Tag, The, Attributes)
Shortcut for creating a DOM node
<static>  
DOMUtil.createPasswordInputNode(nodeValue, options)
Creates a HTML password input
<static>  
DOMUtil.createSubmitInputNode(nodeValue, options)
Creates a HTML submit button
<static>  
DOMUtil.createTable(headerArray, attributes)
<static>  
DOMUtil.createTableHeaderRow(numCells)
Creates a row of empty table header cells
<static>  
DOMUtil.createTableRow(numCells, header)
Creates a table row
<static>  
DOMUtil.createTextElement(tagName, text, attributes)
Creates a node with a textNode as a child
<static>  
DOMUtil.createTextInputNode(nodeValue, options)
Creates a single line HTML text input
<static>  
DOMUtil.emptyNode(The)
Removes all children of the passed node
<static>  
DOMUtil.emptyNodes()
Removes all children of the passed nodes
<static>  
DOMUtil.getIFrameDocument(iframe)
Returns the iFrameDocument object from the passed iFrame in a browser neutral way
<static>  
DOMUtil.getStyle(element, styleToGet)
<static>  
DOMUtil.hasClass(, className)
<static>  
DOMUtil.isInDOM(a)
Returns true if the passed node is in the DOM
<static>  
DOMUtil.removeClass(node, oldClass, recursive)
Removes a CSS class to the passed node, optionally recursing through it's child nodes
<static>  
DOMUtil.setStyle(element, styleToSet, value)
Sets a CSS style on the passed node to the passed value

Constructor Detail

DOMUtil()

Method Detail

<static> {void} DOMUtil.addClass(node, newClass)

Adds a CSS class to the passed node
Parameters:
Name Type Comment
node {Node}
newClass {string}
Returns:
{void}

<static> DOMUtil.addRowToTable(table, rowData)

Parameters:
Name Type Comment
table {Node}
rowData {Object}

<static> {void} DOMUtil.applyAttributesToElement(element, attributes)

Creates a HTML password input
Parameters:
Name Type Comment
element {Node} Node to apply attributes to
attributes {Object} Associative array of attributes to apply to the passed node
Returns:
{void}

<static> DOMUtil.checkDOM()

Boots old browsers to the upgrade page

<static> {Node} DOMUtil.createDefinitionList(values, attributes)

Parameters:
Name Type Comment
values {Array}
attributes {Array}
Returns:
{Node}

<static> {Node} DOMUtil.createElement(Tag, The, Attributes)

Shortcut for creating a DOM node

// <p>Hello world!</p>
DOMUtil.createElement("p", "Hello world!");

// <p class="foo" style="color: red" >Hello world!</p>
DOMUtil.createElement("p", "Hello world!", {className: "foo", style: {color: "red"}});

// <p>Contents as array</p>
DOMUtil.createElement("p", ["Contents", " ", "as", " ", "array"]);
Parameters:
Name Type Comment
Tag {string} name
The {Object} contents of the output node - a string, DOM Node or bbq.gui.GUIWidget
Attributes {Object} that will be applied to the output of this function
Returns:
{Node}

<static> {Node} DOMUtil.createPasswordInputNode(nodeValue, options)

Creates a HTML password input
Parameters:
Name Type Comment
nodeValue {String}
options {Object}
Returns:
{Node}

<static> {Node} DOMUtil.createSubmitInputNode(nodeValue, options)

Creates a HTML submit button
Parameters:
Name Type Comment
nodeValue {String}
options {Object}
Returns:
{Node}

<static> {Node} DOMUtil.createTable(headerArray, attributes)

Parameters:
Name Type Comment
headerArray {Object}
attributes {Object}
Returns:
{Node}

<static> {Node} DOMUtil.createTableHeaderRow(numCells)

Creates a row of empty table header cells
Parameters:
Name Type Comment
numCells {Number}
Returns:
{Node}

<static> {Node} DOMUtil.createTableRow(numCells, header)

Creates a table row
Parameters:
Name Type Comment
numCells {Number}
header {boolean}
Returns:
{Node}

<static> {Node} DOMUtil.createTextElement(tagName, text, attributes)

Creates a node with a textNode as a child
Parameters:
Name Type Comment
tagName {string}
text {string}
attributes {Object}
Deprecated:
Use DOMUtil#createElement instead
Returns:
{Node}

<static> {Node} DOMUtil.createTextInputNode(nodeValue, options)

Creates a single line HTML text input
Parameters:
Name Type Comment
nodeValue {String}
options {Object}
Returns:
{Node}

<static> {Node} DOMUtil.emptyNode(The)

Removes all children of the passed node
Parameters:
Name Type Comment
The {Node} node whose children to remove
Returns:
{Node}

<static> DOMUtil.emptyNodes()

Removes all children of the passed nodes

DOMUtil.emptyNodes(node1, node2…);

<static> {Node} DOMUtil.getIFrameDocument(iframe)

Returns the iFrameDocument object from the passed iFrame in a browser neutral way
Parameters:
Name Type Comment
iframe {Node}
Returns:
{Node}

<static> DOMUtil.getStyle(element, styleToGet)

Parameters:
Name Type Comment
element {Object}
styleToGet {Object}

<static> {boolean} DOMUtil.hasClass(, className)

Parameters:
Name Type Comment
{Node}
className {string}
Returns:
{boolean}

<static> {boolean} DOMUtil.isInDOM(a)

Returns true if the passed node is in the DOM
Parameters:
Name Type Comment
a {Node} DOM Node
Returns:
{boolean}

<static> {void} DOMUtil.removeClass(node, oldClass, recursive)

Removes a CSS class to the passed node, optionally recursing through it's child nodes
Parameters:
Name Type Comment
node {Node}
oldClass {String}
recursive {boolean}
Returns:
{void}

<static> DOMUtil.setStyle(element, styleToSet, value)

Sets a CSS style on the passed node to the passed value
Parameters:
Name Type Comment
element {Node}
styleToSet {Object}
value {Object}