Class DOMUtil
Defined in: DOMUtil.js.
DOMUtil
Utility class with static methods for manipulating the DOM
Constructor Attributes | Constructor Name and Description |
---|---|
DOMUtil()
Utility class with static methods for manipulating the DOM
|
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
|
Method Detail
<static> {void} DOMUtil.addClass(node, newClass)
Adds a CSS class to the passed node
Name | Type | Comment |
---|---|---|
node | {Node} | |
newClass | {string} |
- Returns:
- {void}
<static> DOMUtil.addRowToTable(table, rowData)
Name | Type | Comment |
---|---|---|
table | {Node} | |
rowData | {Object} |
<static> {void} DOMUtil.applyAttributesToElement(element, attributes)
Creates a HTML password input
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)
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"]);
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
Name | Type | Comment |
---|---|---|
nodeValue | {String} | |
options | {Object} |
- Returns:
- {Node}
<static> {Node} DOMUtil.createSubmitInputNode(nodeValue, options)
Creates a HTML submit button
Name | Type | Comment |
---|---|---|
nodeValue | {String} | |
options | {Object} |
- Returns:
- {Node}
<static> {Node} DOMUtil.createTable(headerArray, attributes)
Name | Type | Comment |
---|---|---|
headerArray | {Object} | |
attributes | {Object} |
- Returns:
- {Node}
<static> {Node} DOMUtil.createTableHeaderRow(numCells)
Creates a row of empty table header cells
Name | Type | Comment |
---|---|---|
numCells | {Number} |
- Returns:
- {Node}
<static> {Node} DOMUtil.createTableRow(numCells, header)
Creates a table row
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
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
Name | Type | Comment |
---|---|---|
nodeValue | {String} | |
options | {Object} |
- Returns:
- {Node}
<static> {Node} DOMUtil.emptyNode(The)
Removes all children of the passed node
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
Name | Type | Comment |
---|---|---|
iframe | {Node} |
- Returns:
- {Node}
<static> DOMUtil.getStyle(element, styleToGet)
Name | Type | Comment |
---|---|---|
element | {Object} | |
styleToGet | {Object} |
<static> {boolean} DOMUtil.hasClass(, className)
Name | Type | Comment |
---|---|---|
{Node} | ||
className | {string} |
- Returns:
- {boolean}
<static> {boolean} DOMUtil.isInDOM(a)
Returns true if the passed node is in the DOM
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
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
Name | Type | Comment |
---|---|---|
element | {Node} | |
styleToSet | {Object} | |
value | {Object} |