| goog.dom.DomHelper |
|
opt_document
:
Document object to associate with this DOM helper.
|
|
Use goog.dom.DomHelper.prototype.getElement instead.
Alias for
getElement.
|
code » | |||||
$$(opt_tag, opt_class, opt_el)
⇒ {length: number}
Use DomHelper getElementsByTagNameAndClass.
Alias for
getElementsByTagNameAndClass.
Arguments:
Returns:
{length: number}
Array-like list of elements (only a length property and numerical indices are guaranteed to exist).
|
code » | |||||
|
Use goog.dom.DomHelper.prototype.createDom instead.
Alias for
createDom.
Arguments:
Returns:
Reference to a DOM node.
|
code » | |||||
append(parent, var_args)
Appends a node with text or other nodes.
|
code » | |||||
appendChild(parent, child)
Appends a child to a node.
|
code » | |||||
|
Whether a node contains another node.
|
code » | |||||
|
Returns a dom node with a set of attributes. This function accepts varargs
for subsequent nodes to be added. Subsequent nodes will be added to the
first node as childNodes.
So:
createDom('div', null, createDom('p'), createDom('p'));
would return a div with two child paragraphs
An easy way to move all child nodes of an existing element to a new parent
element is:
createDom('div', null, oldElement.childNodes);
which will remove all child nodes from the old element and add them as
child nodes of the new DIV.
Arguments:
Returns:
Reference to a DOM node.
|
code » | |||||
|
Creates a new element.
|
code » | |||||
|
Create a table.
|
code » | |||||
createTextNode(content)
⇒ Text
Creates a new text node.
Arguments:
Returns:
Text
The new text node.
|
code » | |||||
|
Finds the first descendant node that matches the filter function. This does
a depth first search.
|
code » | |||||
|
Finds all the descendant nodes that matches the filter function. This does a
depth first search.
|
code » | |||||
|
Flattens an element. That is, removes it and replace it with its children.
|
code » | |||||
|
Walks up the DOM hierarchy returning the first ancestor that passes the
matcher function.
Arguments:
Returns:
DOM node that matched the matcher, or null if there was no match.
|
code » | |||||
|
Walks up the DOM hierarchy returning the first ancestor that has the passed
class name. If the passed element matches the specified criteria, the
element itself is returned.
|
code » | |||||
|
Walks up the DOM hierarchy returning the first ancestor that has the passed
tag name and/or class name. If the passed element matches the specified
criteria, the element itself is returned.
Arguments:
Returns:
The first ancestor that matches the passed criteria, or null if none match.
|
code » | |||||
|
use goog.dom.DomHelper.prototype.isCss1CompatMode instead.
Returns the compatMode of the document.
Returns:
The result is either CSS1Compat or BackCompat.
|
code » | |||||
|
Gets the document object being used by the dom library.
Returns:
Document object.
|
code » | |||||
|
Calculates the height of the document.
Returns:
The height of the document.
|
code » | |||||
|
Gets the document scroll distance as a coordinate object.
Returns:
Object with properties 'x' and 'y'.
|
code » | |||||
|
Gets the document scroll element.
Returns:
Scrolling element.
|
code » | |||||
|
Gets the dom helper object for the document where the element resides.
Arguments:
Returns:
The DomHelper.
|
code » | |||||
|
Alias for
getElementById. If a DOM node is passed in then we just
return that.
|
code » | |||||
|
Returns the first element we find matching the provided class name.
|
code » | |||||
getElementsByClass(className, opt_el)
⇒ {length: number}
Returns an array of all the elements with the provided className.
|
code » | |||||
getElementsByTagNameAndClass(opt_tag, opt_class, opt_el)
⇒ {length: number}
Looks up elements by both tag and class name, using browser native functions
(
querySelectorAll, getElementsByTagName or
getElementsByClassName) where possible. The returned array is a live
NodeList or a static list depending on the code path taken.
Arguments:
Returns:
{length: number}
Array-like list of elements (only a length property and numerical indices are guaranteed to exist).
|
code » | |||||
|
Returns the first child node that is an element.
|
code » | |||||
getFrameContentDocument(iframe)
⇒ HTMLDocument
Cross browser function for getting the document element of an iframe.
Arguments:
Returns:
HTMLDocument
The frame content document.
|
code » | |||||
|
Cross browser function for getting the window of a frame or iframe.
Arguments:
Returns:
The window associated with the given frame.
|
code » | |||||
|
Returns the last child node that is an element.
|
code » | |||||
|
Returns the first next sibling that is an element.
|
code » | |||||
|
Returns the next node in source order from the given node.
|
code » | |||||
|
Returns the text length of the text contained in a node, without markup. This
is equivalent to the selection length if the node was selected, or the number
of cursor movements to traverse the node. Images & BRs take one space. New
lines are ignored.
|
code » | |||||
|
Returns the text offset of a node relative to one of its ancestors. The text
length is the same as the length calculated by
goog.dom.getNodeTextLength.
|
code » | |||||
|
Returns the owner document for a node.
|
code » | |||||
|
Returns the first previous sibling that is an element.
|
code » | |||||
|
Returns the previous node in source order from the given node.
|
code » | |||||
|
Returns the text contents of the current node, without markup. New lines are
stripped and whitespace is collapsed, such that each character would be
visible.
In browsers that support it, innerText is used. Other browsers attempt to
simulate it via node traversal. Line breaks are canonicalized in IE.
|
code » | |||||
|
Gets the dimensions of the viewport.
Arguments:
Returns:
Object with values 'width' and 'height'.
|
code » | |||||
|
Gets the window object associated with the document.
Returns:
The window associated with the given document.
|
code » | |||||
|
Converts an HTML string into a node or a document fragment. A single Node
is used if the
htmlString only generates a single node. If the
htmlString generates multiple nodes then these are put inside a
DocumentFragment.
|
code » | |||||
insertSiblingAfter(newNode, refNode)
Inserts a new node after an existing reference node (i.e., as the next
sibling). If the reference node has no parent, then does nothing.
|
code » | |||||
insertSiblingBefore(newNode, refNode)
Inserts a new node before an existing reference node (i.e., as the previous
sibling). If the reference node has no parent, then does nothing.
|
code » | |||||
|
Returns true if the browser is in "CSS1-compatible" (standards-compliant)
mode, false otherwise.
Returns:
True if in CSS1-compatible mode.
|
code » | |||||
|
Whether the object looks like a DOM node.
Arguments:
Returns:
Whether the object looks like a DOM node.
|
code » | |||||
removeChildren(node)
Removes all the child nodes on a DOM node.
Arguments:
|
code » | |||||
|
Removes a node from its parent.
|
code » | |||||
replaceNode(newNode, oldNode)
Replaces a node in the DOM tree. Will do nothing if
oldNode has no
parent.
|
code » | |||||
setDocument(document)
Sets the document object.
Arguments:
|
code » | |||||
setProperties(element, properties)
Sets a number of properties on a node.
|
code » | |||||
setTextContent(element, text)
Cross browser function for setting the text content of an element.
|
code » |