UNPKG

selenium-webdriver

Version:

The official WebDriver JavaScript bindings from the Selenium project

76 lines (73 loc) 69.1 kB
<!DOCTYPE html><meta charset="UTF-8"><meta http-equiv="Content-Language" content="en" /><title>goog.dom.DomHelper</title><link href="dossier.css" rel="stylesheet" type="text/css"><div id="main-wrapper"><input type="checkbox" id="sidenav-toggle" /><main><header><h1>Class goog.dom.DomHelper</h1><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2156">code &raquo;</a></header><section><p>Create an instance of a DOM helper with a new document object.<h2>Constructor</h2><div class="ctor wrap-details public"><div><div class="ctor"><span class="member">goog.dom.DomHelper <span class="args">( opt_document )</span></span></div><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>opt_document: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#i-Document">Document</a>=</code><dd>Document object to associate with this DOM helper.</dl></table></div></div></div></section><div id="visibility-controls"><b>Show:</b><label for="show-public"><span><input type="checkbox" id="show-public" checked/></span>Public</label><label for="show-protected"><span><input type="checkbox" id="show-protected"/></span>Protected</label><label for="show-private"><span><input type="checkbox" id="show-private"/></span>Private</label></div><section id="instance-methods"><h2>Instance Methods</h2><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2223">code &raquo;</a><span class="member deprecation-notice"><a name="$">$</a> <span class="args">( element )</span> &rArr; <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a></code></span></div><div class="deprecation-notice">Deprecated: <span class="deprecation-reason">Use <code class="type"><a href="class_goog_dom_DomHelper.html#getElement">goog.dom.DomHelper.prototype.getElement</a></code> instead.</span></div><p>Alias for <code >getElement</code>.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>element: <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a>)</code><dd>Element ID or a DOM node.</dl><tr><th>Returns<tr><td><dl>The element with the given ID, or the node passed in.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2302">code &raquo;</a><span class="member deprecation-notice"><a name="$$">$$</a> <span class="args">( opt_tag, opt_class, opt_el )</span> &rArr; <code class="type">{length: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>}</code></span></div><div class="deprecation-notice">Deprecated: <span class="deprecation-reason">Use DomHelper getElementsByTagNameAndClass.</span></div><p>Alias for <code >getElementsByTagNameAndClass</code>.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>opt_tag: <code class="type">?<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>=</code><dd>Element tag name.<dt>opt_class: <code class="type">?<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>=</code><dd>Optional class name.<dt>opt_el: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a>=</code><dd>Optional element to look in.</dl><tr><th>Returns<tr><td><dl>Array-like list of elements (only a length property and numerical indices are guaranteed to exist).</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2387">code &raquo;</a><span class="member deprecation-notice"><a name="$dom">$dom</a> <span class="args">( tagName, opt_attributes, var_args )</span> &rArr; <code class="type">!<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a></code></span></div><div class="deprecation-notice">Deprecated: <span class="deprecation-reason">Use <code class="type"><a href="class_goog_dom_DomHelper.html#createDom">goog.dom.DomHelper.prototype.createDom</a></code> instead.</span></div><p>Alias for <code >createDom</code>.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>tagName: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>Tag to create.<dt>opt_attributes: <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)=</code><dd>If object, then a map of name-value pairs for attributes. If a string, then this is the className of the new element.<dt>var_args: <code class="type">...<a href="namespace_goog_dom.html#goog.dom.Appendable">goog.dom.Appendable</a></code><dd>Further DOM nodes or strings for text nodes. If one of the var_args is an array, its children will be added as childNodes instead.</dl><tr><th>Returns<tr><td><dl>Reference to a DOM node.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2501">code &raquo;</a><span class="member"><a name="append">append</a> <span class="args">( parent, var_args )</span></span></div><p>Appends a node with text or other nodes.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>parent: <code class="type">!<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code><dd>The node to append nodes to.<dt>var_args: <code class="type">...<a href="namespace_goog_dom.html#goog.dom.Appendable">goog.dom.Appendable</a></code><dd>The things to append to the node. If this is a Node it is appended as is. If this is a string then a text node is appended. If this is an array like object then fields 0 to length - 1 are appended.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2490">code &raquo;</a><span class="member"><a name="appendChild">appendChild</a> <span class="args">( parent, child )</span></span></div><p>Appends a child to a node.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>parent: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code><dd>Parent.<dt>child: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code><dd>Child.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2511">code &raquo;</a><span class="member"><a name="canHaveChildren">canHaveChildren</a> <span class="args">( node )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Determines if the given node can contain children, intended to be used for HTML generation.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>node: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code><dd>The node to check.</dl><tr><th>Returns<tr><td><dl>Whether the node can contain children.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2695">code &raquo;</a><span class="member"><a name="compareNodeOrder">compareNodeOrder</a> <span class="args">( node1, node2 )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Compares the document order of two nodes, returning 0 if they are the same node, a negative number if node1 is before node2, and a positive number if node2 is before node1. Note that we compare the order the tags appear in the document so in the tree <b><i>text</i></b> the B node is considered to be before the I node.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>node1: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code><dd>The first node to compare.<dt>node2: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code><dd>The second node to compare.</dl><tr><th>Returns<tr><td><dl>0 if the nodes are the same node, a negative number if node1 is before node2, and a positive number if node2 is before node1.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2680">code &raquo;</a><span class="member"><a name="contains">contains</a> <span class="args">( parent, descendant )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Whether a node contains another node.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>parent: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code><dd>The node that should contain the other node.<dt>descendant: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code><dd>The node to test presence of.</dl><tr><th>Returns<tr><td><dl>Whether the parent node contains the descendent node.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2368">code &raquo;</a><span class="member"><a name="createDom">createDom</a> <span class="args">( tagName, opt_attributes, var_args )</span> &rArr; <code class="type">!<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a></code></span></div><p>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: <code>createDom('div', null, createDom('p'), createDom('p'));</code> 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: <code>createDom('div', null, oldElement.childNodes);</code> which will remove all child nodes from the old element and add them as child nodes of the new DIV.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>tagName: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>Tag to create.<dt>opt_attributes: <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)=</code><dd>If object, then a map of name-value pairs for attributes. If a string, then this is the className of the new element.<dt>var_args: <code class="type">...<a href="namespace_goog_dom.html#goog.dom.Appendable">goog.dom.Appendable</a></code><dd>Further DOM nodes or strings for text nodes. If one of the var_args is an array or NodeList, its elements will be added as childNodes instead.</dl><tr><th>Returns<tr><td><dl>Reference to a DOM node.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2395">code &raquo;</a><span class="member"><a name="createElement">createElement</a> <span class="args">( name )</span> &rArr; <code class="type">!<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a></code></span></div><p>Creates a new element.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>name: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>Tag name.</dl><tr><th>Returns<tr><td><dl>The new element.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2417">code &raquo;</a><span class="member"><a name="createTable">createTable</a> <span class="args">( rows, columns, opt_fillWithNbsp )</span> &rArr; <code class="type">!<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a></code></span></div><p>Create a table.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>rows: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The number of rows in the table. Must be >= 1.<dt>columns: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The number of columns in the table. Must be >= 1.<dt>opt_fillWithNbsp: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>=</code><dd>If true, fills table entries with nsbps.</dl><tr><th>Returns<tr><td><dl>The created table.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2405">code &raquo;</a><span class="member"><a name="createTextNode">createTextNode</a> <span class="args">( content )</span> &rArr; <code class="type">!<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1312295772">Text</a></code></span></div><p>Creates a new text node.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>content: <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code><dd>Content.</dl><tr><th>Returns<tr><td><dl>The new text node.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2705">code &raquo;</a><span class="member"><a name="findCommonAncestor">findCommonAncestor</a> <span class="args">( var_args )</span> &rArr; <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code></span></div><p>Find the deepest common ancestor of the given nodes.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>var_args: <code class="type">...<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code><dd>The nodes to find a common ancestor of.</dl><tr><th>Returns<tr><td><dl>The common ancestor of the nodes, or null if there is none. null will only be returned if two or more of the nodes are from different documents.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2758">code &raquo;</a><span class="member"><a name="findNode">findNode</a> <span class="args">( root, p )</span> &rArr; <code class="type">(<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined">undefined</a>)</code></span></div><p>Finds the first descendant node that matches the filter function. This does a depth first search.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>root: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code><dd>The root of the tree to search.<dt>p: <code class="type">function(<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a>): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code><dd>The filter function.</dl><tr><th>Returns<tr><td><dl>The found node or undefined if none is found.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2768">code &raquo;</a><span class="member"><a name="findNodes">findNodes</a> <span class="args">( root, p )</span> &rArr; <code class="type"><a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>.&lt;<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a>&gt;</code></span></div><p>Finds all the descendant nodes that matches the filter function. This does a depth first search.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>root: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code><dd>The root of the tree to search.<dt>p: <code class="type">function(<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a>): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code><dd>The filter function.</dl><tr><th>Returns<tr><td><dl>The found nodes or an empty array if none are found.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2575">code &raquo;</a><span class="member"><a name="flattenElement">flattenElement</a> <span class="args">( element )</span> &rArr; <code class="type">(<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined">undefined</a>)</code></span></div><p>Flattens an element. That is, removes it and replace it with its children.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>element: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a></code><dd>The element to flatten.</dl><tr><th>Returns<tr><td><dl>The original element, detached from the document tree, sans children, or undefined if the element was already not in the document.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2480">code &raquo;</a><span class="member"><a name="getActiveElement">getActiveElement</a> <span class="args">( opt_doc )</span> &rArr; <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a></code></span></div><p>Determines the active element in the given document.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>opt_doc: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#i-Document">Document</a>=</code><dd>The document to look in.</dl><tr><th>Returns<tr><td><dl>The active element.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2910">code &raquo;</a><span class="member"><a name="getAncestor">getAncestor</a> <span class="args">( element, matcher, opt_includeNode, opt_maxSearchSteps )</span> &rArr; <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code></span></div><p>Walks up the DOM hierarchy returning the first ancestor that passes the matcher function.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>element: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code><dd>The DOM node to start with.<dt>matcher: <code class="type">function(<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a>): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code><dd>A function that returns true if the passed node matches the desired criteria.<dt>opt_includeNode: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>=</code><dd>If true, the node itself is included in the search (the first call to the matcher will pass startElement as the node to test).<dt>opt_maxSearchSteps: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>=</code><dd>Maximum number of levels to search up the dom.</dl><tr><th>Returns<tr><td><dl>DOM node that matched the matcher, or null if there was no match.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2892">code &raquo;</a><span class="member"><a name="getAncestorByClass">getAncestorByClass</a> <span class="args">( element, class )</span> &rArr; <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a></code></span></div><p>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.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>element: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code><dd>The DOM node to start with.<dt>class: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The class name to match.</dl><tr><th>Returns<tr><td><dl>The first ancestor that matches the passed criteria, or null if none match.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2879">code &raquo;</a><span class="member"><a name="getAncestorByTagNameAndClass">getAncestorByTagNameAndClass</a> <span class="args">( element, opt_tag, opt_class )</span> &rArr; <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a></code></span></div><p>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.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>element: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code><dd>The DOM node to start with.<dt>opt_tag: <code class="type">?(<a href="enum_goog_dom_TagName.html">goog.dom.TagName</a>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)=</code><dd>The tag name to match (or null/undefined to match only based on class name).<dt>opt_class: <code class="type">?<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>=</code><dd>The class name to match (or null/undefined to match only based on tag name).</dl><tr><th>Returns<tr><td><dl>The first ancestor that matches the passed criteria, or null if no match is found.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2584">code &raquo;</a><span class="member"><a name="getChildren">getChildren</a> <span class="args">( element )</span> &rArr; <code class="type">!(<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>|<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-536297177">NodeList</a>)</code></span></div><p>Returns an array containing just the element children of the given element.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>element: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a></code><dd>The element whose element children we want.</dl><tr><th>Returns<tr><td><dl>An array or array-like list of just the element children of the given element.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2187">code &raquo;</a><span class="member"><a name="getDocument">getDocument</a> <span class="args">( )</span> &rArr; <code class="type">!<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#i-Document">Document</a></code></span></div><p>Gets the document object being used by the dom library.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>Document object.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2332">code &raquo;</a><span class="member"><a name="getDocumentHeight">getDocumentHeight</a> <span class="args">( )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Calculates the height of the document.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>The height of the document.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2470">code &raquo;</a><span class="member"><a name="getDocumentScroll">getDocumentScroll</a> <span class="args">( )</span> &rArr; <code class="type">!<a href="class_goog_math_Coordinate.html">goog.math.Coordinate</a></code></span></div><p>Gets the document scroll distance as a coordinate object.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>Object with properties 'x' and 'y'.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2461">code &raquo;</a><span class="member"><a name="getDocumentScrollElement">getDocumentScrollElement</a> <span class="args">( )</span> &rArr; <code class="type">!<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a></code></span></div><p>Gets the document scroll element.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>Scrolling element.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2171">code &raquo;</a><span class="member"><a name="getDomHelper">getDomHelper</a> <span class="args">( opt_node )</span> &rArr; <code class="type">!<a href="class_goog_dom_DomHelper.html">goog.dom.DomHelper</a></code></span></div><p>Gets the dom helper object for the document where the element resides.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>opt_node: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a>=</code><dd>If present, gets the DomHelper for this node.</dl><tr><th>Returns<tr><td><dl>The DomHelper.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2198">code &raquo;</a><span class="member"><a name="getElement">getElement</a> <span class="args">( element )</span> &rArr; <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a></code></span></div><p>Alias for <code >getElementById</code>. If a DOM node is passed in then we just return that.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>element: <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a>)</code><dd>Element ID or a DOM node.</dl><tr><th>Returns<tr><td><dl>The element with the given ID, or the node passed in.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2268">code &raquo;</a><span class="member"><a name="getElementByClass">getElementByClass</a> <span class="args">( className, opt_el )</span> &rArr; <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a></code></span></div><p>Returns the first element we find matching the provided class name.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>className: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>the name of the class to look for.<dt>opt_el: <code class="type">(<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a>|<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#i-Document">Document</a>)=</code><dd>Optional element to look in.</dl><tr><th>Returns<tr><td><dl>The first item found with the class name provided.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2255">code &raquo;</a><span class="member"><a name="getElementsByClass">getElementsByClass</a> <span class="args">( className, opt_el )</span> &rArr; <code class="type">{length: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>}</code></span></div><p>Returns an array of all the elements with the provided className.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>className: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>the name of the class to look for.<dt>opt_el: <code class="type">(<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a>|<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#i-Document">Document</a>)=</code><dd>Optional element to look in.</dl><tr><th>Returns<tr><td><dl>The items found with the class name provided.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2240">code &raquo;</a><span class="member"><a name="getElementsByTagNameAndClass">getElementsByTagNameAndClass</a> <span class="args">( opt_tag, opt_class, opt_el )</span> &rArr; <code class="type">{length: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>}</code></span></div><p>Looks up elements by both tag and class name, using browser native functions (<code >querySelectorAll</code>, <code >getElementsByTagName</code> or <code >getElementsByClassName</code>) where possible. The returned array is a live NodeList or a static list depending on the code path taken.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>opt_tag: <code class="type">?<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>=</code><dd>Element tag name or * for all tags.<dt>opt_class: <code class="type">?<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>=</code><dd>Optional class name.<dt>opt_el: <code class="type">(<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#i-Document">Document</a>|<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a>)=</code><dd>Optional element to look in.</dl><tr><th>Returns<tr><td><dl>Array-like list of elements (only a length property and numerical indices are guaranteed to exist).</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2592">code &raquo;</a><span class="member"><a name="getFirstElementChild">getFirstElementChild</a> <span class="args">( node )</span> &rArr; <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a></code></span></div><p>Returns the first child node that is an element.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>node: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code><dd>The node to get the first child element of.</dl><tr><th>Returns<tr><td><dl>The first child node of <code >node</code> that is an element.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2721">code &raquo;</a><span class="member"><a name="getFrameContentDocument">getFrameContentDocument</a> <span class="args">( iframe )</span> &rArr; <code class="type">!<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#i-Document">Document</a></code></span></div><p>Cross browser function for getting the document element of an iframe.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>iframe: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a></code><dd>Iframe element.</dl><tr><th>Returns<tr><td><dl>The frame content document.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2730">code &raquo;</a><span class="member"><a name="getFrameContentWindow">getFrameContentWindow</a> <span class="args">( frame )</span> &rArr; <code class="type">Window</code></span></div><p>Cross browser function for getting the window of a frame or iframe.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>frame: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a></code><dd>Frame element.</dl><tr><th>Returns<tr><td><dl>The window associated with the given frame.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2601">code &raquo;</a><span class="member"><a name="getLastElementChild">getLastElementChild</a> <span class="args">( node )</span> &rArr; <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a></code></span></div><p>Returns the last child node that is an element.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>node: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code><dd>The node to get the last child element of.</dl><tr><th>Returns<tr><td><dl>The last child node of <code >node</code> that is an element.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2609">code &raquo;</a><span class="member"><a name="getNextElementSibling">getNextElementSibling</a> <span class="args">( node )</span> &rArr; <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a></code></span></div><p>Returns the first next sibling that is an element.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>node: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code><dd>The node to get the next sibling element of.</dl><tr><th>Returns<tr><td><dl>The next sibling of <code >node</code> that is an element.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2629">code &raquo;</a><span class="member"><a name="getNextNode">getNextNode</a> <span class="args">( node )</span> &rArr; <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code></span></div><p>Returns the next node in source order from the given node.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>node: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code><dd>The node.</dl><tr><th>Returns<tr><td><dl>The next node in the DOM tree, or null if this was the last node.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2854">code &raquo;</a><span class="member"><a name="getNodeAtOffset">getNodeAtOffset</a> <span class="args">( parent, offset, opt_result )</span> &rArr; <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code></span></div><p>Returns the node at a given offset in a parent node. If an object is provided for the optional third parameter, the node and the remainder of the offset will stored as properties of this object.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>parent: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code><dd>The parent node.<dt>offset: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The offset into the parent node.<dt>opt_result: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>=</code><dd>Object to be used to store the return value. The return value will be stored in the form {node: Node, remainder: number} if this object is provided.</dl><tr><th>Returns<tr><td><dl>The node at the given offset.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2828">code &raquo;</a><span class="member"><a name="getNodeTextLength">getNodeTextLength</a> <span class="args">( node )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>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.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>node: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code><dd>The node whose text content length is being calculated.</dl><tr><th>Returns<tr><td><dl>The length of <code >node</code>'s text content.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2840">code &raquo;</a><span class="member"><a name="getNodeTextOffset">getNodeTextOffset</a> <span class="args">( node, opt_offsetParent )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Returns the text offset of a node relative to one of its ancestors. The text length is the same as the length calculated by <code >goog.dom.getNodeTextLength</code>.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>node: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code><dd>The node whose offset is being calculated.<dt>opt_offsetParent: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a>=</code><dd>Defaults to the node's owner document's body.</dl><tr><th>Returns<tr><td><dl>The text offset.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2748">code &raquo;</a><span class="member"><a name="getOuterHtml">getOuterHtml</a> <span class="args">( element )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Gets the outerHTML of a node, which islike innerHTML, except that it actually contains the HTML of the node itself.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>element: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a></code><dd>The element to get the HTML of.</dl><tr><th>Returns<tr><td><dl>The outerHTML of the given element.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2713">code &raquo;</a><span class="member"><a name="getOwnerDocument">getOwnerDocument</a> <span class="args">( node )</span> &rArr; <code class="type">!<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#i-Document">Document</a></code></span></div><p>Returns the owner document for a node.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>node: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code><dd>The node to get the document for.</dl><tr><th>Returns<tr><td><dl>The document owning the node.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2671">code &raquo;</a><span class="member"><a name="getParentElement">getParentElement</a> <span class="args">( element )</span> &rArr; <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a></code></span></div><p>Returns an element's parent, if it's an Element.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>element: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a></code><dd>The DOM element.</dl><tr><th>Returns<tr><td><dl>The parent, or null if not an Element.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2619">code &raquo;</a><span class="member"><a name="getPreviousElementSibling">getPreviousElementSibling</a> <span class="args">( node )</span> &rArr; <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a></code></span></div><p>Returns the first previous sibling that is an element.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>node: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code><dd>The node to get the previous sibling element of.</dl><tr><th>Returns<tr><td><dl>The first previous sibling of <code >node</code> that is an element.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2638">code &raquo;</a><span class="member"><a name="getPreviousNode">getPreviousNode</a> <span class="args">( node )</span> &rArr; <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code></span></div><p>Returns the previous node in source order from the given node.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>node: <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1950641247">Node</a></code><dd>The node.</dl><tr><th>Returns<tr><td><dl>The previous node in the DOM tree, or null if this was the first node.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2212">code &raquo;</a><span class="member"><a name="getRequiredElement">getRequiredElement</a> <span class="args">( id )</span> &rArr; <code class="type">!<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a></code></span></div><p>Gets an element by id, asserting that the element is found. This is used when an element is expected to exist, and should fail with an assertion error if it does not (if assertions are enabled).</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>id: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>Element ID.</dl><tr><th>Returns<tr><td><dl>The element with the given ID, if it exists.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2284">code &raquo;</a><span class="member"><a name="getRequiredElementByClass">getRequiredElementByClass</a> <span class="args">( className, opt_root )</span> &rArr; <code class="type">!<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a></code></span></div><p>Ensures an element with the given className exists, and then returns the first element with the provided className.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>className: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>the name of the class to look for.<dt>opt_root: <code class="type">(!<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a>|!<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#i-Document">Document</a>)=</code><dd>Optional element or document to look in.</dl><tr><th>Returns<tr><td><dl>The first item found with the class name provided.</dl><tr><th>Throws<tr><td><dl><dt><code class="type"><a href="class_goog_asserts_AssertionError.html">goog.asserts.AssertionError</a></code><dd>Thrown if no element is found.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/dom/dom.js.src.html#l2816">code &raquo;</a><span class="member"><a name="getTextContent">