webgui/www/extras/yui/docs/YAHOO.util.Dom.html
2008-03-25 16:13:25 +00:00

2548 lines
135 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>API: dom YAHOO.util.Dom (YUI Library)</title>
<link rel="stylesheet" type="text/css" href="assets/api.css">
<script type="text/javascript" src="assets/api-js"></script>
<script type="text/javascript" src="assets/ac-js"></script>
</head>
<body id="yahoo-com">
<div id="doc3" class="yui-t2">
<div id="hd">
<a href="http://developer.yahoo.com/yui/"><h1>Yahoo! UI Library</h1></a>
<h3>dom&nbsp; <span class="subtitle">2.5.1</span></h3>
<p>
<a href="./index.html">Yahoo! UI Library</a>
&gt; <a href="./module_dom.html">dom</a>
&gt; YAHOO.util.Dom
</p>
</div>
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<form name="yui-classopts-form">
<span id="classopts"><input type="checkbox" name="showprivate" id="showprivate" /> Show Private</span>
<span id="classopts"><input type="checkbox" name="showprotected" id="showprotected" /> Show Protected</span>
</form>
<h2>
Class <b>YAHOO.util.Dom</b>
<span class="extends">
</span>
<span class="extends">
</span>
</code>
</h2>
<!-- class tree goes here -->
<div class="summary description">
Provides helper methods for DOM elements.
</div>
<div class="section method details">
<h3 id="methods">Methods</h3>
<div class="content">
<div class="">
<h4>
<a name="method_addClass">addClass</a></h4>
<div class="detail">
<code>
Boolean | Array
<strong>addClass</strong>
(
el
,
className
)
</code>
<div class="description">
Adds a class name to a given element or collection of elements.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>el &lt;String | HTMLElement | Array&gt;</code>
The element or collection to add the class to
</dd>
<dd>
<code>className &lt;String&gt;</code>
the class name to add to the class attribute
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Boolean | Array
</code></dt>
<dd>A pass/fail boolean or array of booleans</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_batch">batch</a></h4>
<div class="detail">
<code>
Any | Array
<strong>batch</strong>
(
el
,
method
,
o
,
override
)
</code>
<div class="description">
Runs the supplied method against each item in the Collection/Array.
The method is called with the element(s) as the first arg, and the optional param as the second ( method(el, o) ).
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>el &lt;String | HTMLElement | Array&gt;</code>
(optional) An element or array of elements to apply the method to
</dd>
<dd>
<code>method &lt;Function&gt;</code>
The method to apply to the element(s)
</dd>
<dd>
<code>o &lt;Any&gt;</code>
(optional) An optional arg that is passed to the supplied method
</dd>
<dd>
<code>override &lt;Boolean&gt;</code>
(optional) Whether or not to override the scope of "method" with "o"
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Any | Array
</code></dt>
<dd>The return value(s) from the supplied method</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_generateId">generateId</a></h4>
<div class="detail">
<code>
String | Array
<strong>generateId</strong>
(
el
,
prefix
)
</code>
<div class="description">
Returns an ID and applies it to the element "el", if provided.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>el &lt;String | HTMLElement | Array&gt;</code>
(optional) An optional element array of elements to add an ID to (no ID is added if one is already present).
</dd>
<dd>
<code>prefix &lt;String&gt;</code>
(optional) an optional prefix to use (defaults to "yui-gen").
</dd>
</dl>
<dl>
<dt>Returns:
<code>
String | Array
</code></dt>
<dd>The generated ID, or array of generated IDs (or original ID if already present on an element)</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_get">get</a></h4>
<div class="detail">
<code>
HTMLElement | Array
<strong>get</strong>
(
el
)
</code>
<div class="description">
Returns an HTMLElement reference.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>el &lt;String | HTMLElement |Array&gt;</code>
Accepts a string to use as an ID for getting a DOM reference, an actual DOM reference, or an Array of IDs and/or HTMLElements.
</dd>
</dl>
<dl>
<dt>Returns:
<code>
HTMLElement | Array
</code></dt>
<dd>A DOM reference to an HTML element or an array of HTMLElements.</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getAncestorBy">getAncestorBy</a></h4>
<div class="detail">
<code>
Object
<strong>getAncestorBy</strong>
(
node
,
method
)
</code>
<div class="description">
Returns the nearest ancestor that passes the test applied by supplied boolean method.
For performance reasons, IDs are not accepted and argument validation omitted.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>node &lt;HTMLElement&gt;</code>
The HTMLElement to use as the starting point
</dd>
<dd>
<code>method &lt;Function&gt;</code>
- A boolean method for testing elements which receives the element as its only argument.
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Object
</code></dt>
<dd>HTMLElement or null if not found</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getAncestorByClassName">getAncestorByClassName</a></h4>
<div class="detail">
<code>
Object
<strong>getAncestorByClassName</strong>
(
node
,
className
)
</code>
<div class="description">
Returns the nearest ancestor with the given className.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>node &lt;String | HTMLElement&gt;</code>
The HTMLElement or an ID to use as the starting point
</dd>
<dd>
<code>className &lt;String&gt;</code>
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Object
</code></dt>
<dd>HTMLElement</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getAncestorByTagName">getAncestorByTagName</a></h4>
<div class="detail">
<code>
Object
<strong>getAncestorByTagName</strong>
(
node
,
tagName
)
</code>
<div class="description">
Returns the nearest ancestor with the given tagName.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>node &lt;String | HTMLElement&gt;</code>
The HTMLElement or an ID to use as the starting point
</dd>
<dd>
<code>tagName &lt;String&gt;</code>
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Object
</code></dt>
<dd>HTMLElement</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getChildren">getChildren</a></h4>
<div class="detail">
<code>
Array
<strong>getChildren</strong>
(
node
)
</code>
<div class="description">
Returns an array of HTMLElement childNodes.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>node &lt;String | HTMLElement&gt;</code>
The HTMLElement or an ID to use as the starting point
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Array
</code></dt>
<dd>A static array of HTMLElements</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getChildrenBy">getChildrenBy</a></h4>
<div class="detail">
<code>
Array
<strong>getChildrenBy</strong>
(
node
,
method
)
</code>
<div class="description">
Returns an array of HTMLElement childNodes that pass the test method.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>node &lt;HTMLElement&gt;</code>
The HTMLElement to start from
</dd>
<dd>
<code>method &lt;Function&gt;</code>
A boolean function used to test children
that receives the node being tested as its only argument
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Array
</code></dt>
<dd>A static array of HTMLElements</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getClientHeight">getClientHeight</a></h4>
<div class="detail">
<code>
Int
<strong>getClientHeight</strong>
(
)
</code>
<div class="description">
Returns the height of the client (viewport).
</div>
<div class="description">
<dl>
<dt>Returns:
<code>
Int
</code></dt>
<dd>The height of the viewable area of the page.</dd>
</dl>
<div class="deprecated">
<strong>Deprecated</strong> Now using getViewportHeight. This interface left intact for back compat.
</div>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getClientRegion">getClientRegion</a></h4>
<div class="detail">
<code>
Region
<strong>getClientRegion</strong>
(
)
</code>
<div class="description">
Creates a Region based on the viewport relative to the document.
</div>
<div class="description">
<dl>
<dt>Returns:
<code>
Region
</code></dt>
<dd>A Region object representing the viewport which accounts for document scroll</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getClientWidth">getClientWidth</a></h4>
<div class="detail">
<code>
Int
<strong>getClientWidth</strong>
(
)
</code>
<div class="description">
Returns the width of the client (viewport).
</div>
<div class="description">
<dl>
<dt>Returns:
<code>
Int
</code></dt>
<dd>The width of the viewable area of the page.</dd>
</dl>
<div class="deprecated">
<strong>Deprecated</strong> Now using getViewportWidth. This interface left intact for back compat.
</div>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getDocumentHeight">getDocumentHeight</a></h4>
<div class="detail">
<code>
Int
<strong>getDocumentHeight</strong>
(
)
</code>
<div class="description">
Returns the height of the document.
</div>
<div class="description">
<dl>
<dt>Returns:
<code>
Int
</code></dt>
<dd>The height of the actual document (which includes the body and its margin).</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getDocumentScrollLeft">getDocumentScrollLeft</a></h4>
<div class="detail">
<code>
Int
<strong>getDocumentScrollLeft</strong>
(
document
)
</code>
<div class="description">
Returns the left scroll value of the document
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>document &lt;HTMLDocument&gt;</code>
(optional) The document to get the scroll value of
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Int
</code></dt>
<dd>The amount that the document is scrolled to the left</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getDocumentScrollTop">getDocumentScrollTop</a></h4>
<div class="detail">
<code>
Int
<strong>getDocumentScrollTop</strong>
(
document
)
</code>
<div class="description">
Returns the top scroll value of the document
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>document &lt;HTMLDocument&gt;</code>
(optional) The document to get the scroll value of
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Int
</code></dt>
<dd>The amount that the document is scrolled to the top</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getDocumentWidth">getDocumentWidth</a></h4>
<div class="detail">
<code>
Int
<strong>getDocumentWidth</strong>
(
)
</code>
<div class="description">
Returns the width of the document.
</div>
<div class="description">
<dl>
<dt>Returns:
<code>
Int
</code></dt>
<dd>The width of the actual document (which includes the body and its margin).</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getElementsBy">getElementsBy</a></h4>
<div class="detail">
<code>
Array
<strong>getElementsBy</strong>
(
method
,
tag
,
root
,
apply
)
</code>
<div class="description">
Returns a array of HTMLElements that pass the test applied by supplied boolean method.
For optimized performance, include a tag and/or root node when possible.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>method &lt;Function&gt;</code>
- A boolean method for testing elements which receives the element as its only argument.
</dd>
<dd>
<code>tag &lt;String&gt;</code>
(optional) The tag name of the elements being collected
</dd>
<dd>
<code>root &lt;String | HTMLElement&gt;</code>
(optional) The HTMLElement or an ID to use as the starting point
</dd>
<dd>
<code>apply &lt;Function&gt;</code>
(optional) A function to apply to each element when found
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Array
</code></dt>
<dd>Array of HTMLElements</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getElementsByClassName">getElementsByClassName</a></h4>
<div class="detail">
<code>
Array
<strong>getElementsByClassName</strong>
(
className
,
tag
,
root
,
apply
)
</code>
<div class="description">
Returns a array of HTMLElements with the given class.
For optimized performance, include a tag and/or root node when possible.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>className &lt;String&gt;</code>
The class name to match against
</dd>
<dd>
<code>tag &lt;String&gt;</code>
(optional) The tag name of the elements being collected
</dd>
<dd>
<code>root &lt;String | HTMLElement&gt;</code>
(optional) The HTMLElement or an ID to use as the starting point
</dd>
<dd>
<code>apply &lt;Function&gt;</code>
(optional) A function to apply to each element when found
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Array
</code></dt>
<dd>An array of elements that have the given class name</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getFirstChild">getFirstChild</a></h4>
<div class="detail">
<code>
Object
<strong>getFirstChild</strong>
(
node
)
</code>
<div class="description">
Returns the first HTMLElement child.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>node &lt;String | HTMLElement&gt;</code>
The HTMLElement or an ID to use as the starting point
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Object
</code></dt>
<dd>HTMLElement or null if not found</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getFirstChildBy">getFirstChildBy</a></h4>
<div class="detail">
<code>
Object
<strong>getFirstChildBy</strong>
(
node
,
method
)
</code>
<div class="description">
Returns the first HTMLElement child that passes the test method.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>node &lt;HTMLElement&gt;</code>
The HTMLElement to use as the starting point
</dd>
<dd>
<code>method &lt;Function&gt;</code>
A boolean function used to test children
that receives the node being tested as its only argument
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Object
</code></dt>
<dd>HTMLElement or null if not found</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getLastChild">getLastChild</a></h4>
<div class="detail">
<code>
Object
<strong>getLastChild</strong>
(
node
)
</code>
<div class="description">
Returns the last HTMLElement child.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>node &lt;String | HTMLElement&gt;</code>
The HTMLElement or an ID to use as the starting point
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Object
</code></dt>
<dd>HTMLElement or null if not found</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getLastChildBy">getLastChildBy</a></h4>
<div class="detail">
<code>
Object
<strong>getLastChildBy</strong>
(
node
,
method
)
</code>
<div class="description">
Returns the last HTMLElement child that passes the test method.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>node &lt;HTMLElement&gt;</code>
The HTMLElement to use as the starting point
</dd>
<dd>
<code>method &lt;Function&gt;</code>
A boolean function used to test children
that receives the node being tested as its only argument
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Object
</code></dt>
<dd>HTMLElement or null if not found</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getNextSibling">getNextSibling</a></h4>
<div class="detail">
<code>
Object
<strong>getNextSibling</strong>
(
node
)
</code>
<div class="description">
Returns the next sibling that is an HTMLElement
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>node &lt;String | HTMLElement&gt;</code>
The HTMLElement or an ID to use as the starting point
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Object
</code></dt>
<dd>HTMLElement or null if not found</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getNextSiblingBy">getNextSiblingBy</a></h4>
<div class="detail">
<code>
Object
<strong>getNextSiblingBy</strong>
(
node
,
method
)
</code>
<div class="description">
Returns the next HTMLElement sibling that passes the boolean method.
For performance reasons, IDs are not accepted and argument validation omitted.
Returns the nearest HTMLElement sibling if no method provided.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>node &lt;HTMLElement&gt;</code>
The HTMLElement to use as the starting point
</dd>
<dd>
<code>method &lt;Function&gt;</code>
A boolean function used to test siblings
that receives the sibling node being tested as its only argument
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Object
</code></dt>
<dd>HTMLElement or null if not found</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getPreviousSibling">getPreviousSibling</a></h4>
<div class="detail">
<code>
Object
<strong>getPreviousSibling</strong>
(
node
)
</code>
<div class="description">
Returns the previous sibling that is an HTMLElement
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>node &lt;String | HTMLElement&gt;</code>
The HTMLElement or an ID to use as the starting point
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Object
</code></dt>
<dd>HTMLElement or null if not found</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getPreviousSiblingBy">getPreviousSiblingBy</a></h4>
<div class="detail">
<code>
Object
<strong>getPreviousSiblingBy</strong>
(
node
,
method
)
</code>
<div class="description">
Returns the previous sibling that is an HTMLElement.
For performance reasons, IDs are not accepted and argument validation omitted.
Returns the nearest HTMLElement sibling if no method provided.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>node &lt;HTMLElement&gt;</code>
The HTMLElement to use as the starting point
</dd>
<dd>
<code>method &lt;Function&gt;</code>
A boolean function used to test siblings
that receives the sibling node being tested as its only argument
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Object
</code></dt>
<dd>HTMLElement or null if not found</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getRegion">getRegion</a></h4>
<div class="detail">
<code>
Region | Array
<strong>getRegion</strong>
(
el
)
</code>
<div class="description">
Returns the region position of the given element.
The element must be part of the DOM tree to have a region (display:none or elements not appended return false).
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>el &lt;String | HTMLElement | Array&gt;</code>
Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Region | Array
</code></dt>
<dd>A Region or array of Region instances containing "top, left, bottom, right" member data.</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getStyle">getStyle</a></h4>
<div class="detail">
<code>
String | Array
<strong>getStyle</strong>
(
el
,
property
)
</code>
<div class="description">
Normalizes currentStyle and ComputedStyle.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>el &lt;String | HTMLElement |Array&gt;</code>
Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
</dd>
<dd>
<code>property &lt;String&gt;</code>
The style property whose value is returned.
</dd>
</dl>
<dl>
<dt>Returns:
<code>
String | Array
</code></dt>
<dd>The current value of the style property for the element(s).</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getViewportHeight">getViewportHeight</a></h4>
<div class="detail">
<code>
Int
<strong>getViewportHeight</strong>
(
)
</code>
<div class="description">
Returns the current height of the viewport.
</div>
<div class="description">
<dl>
<dt>Returns:
<code>
Int
</code></dt>
<dd>The height of the viewable area of the page (excludes scrollbars).</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getViewportWidth">getViewportWidth</a></h4>
<div class="detail">
<code>
Int
<strong>getViewportWidth</strong>
(
)
</code>
<div class="description">
Returns the current width of the viewport.
</div>
<div class="description">
<dl>
<dt>Returns:
<code>
Int
</code></dt>
<dd>The width of the viewable area of the page (excludes scrollbars).</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getX">getX</a></h4>
<div class="detail">
<code>
Number | Array
<strong>getX</strong>
(
el
)
</code>
<div class="description">
Gets the current X position of an element based on page coordinates. The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>el &lt;String | HTMLElement | Array&gt;</code>
Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Number | Array
</code></dt>
<dd>The X position of the element(s)</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getXY">getXY</a></h4>
<div class="detail">
<code>
Array
<strong>getXY</strong>
(
el
)
</code>
<div class="description">
Gets the current position of an element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>el &lt;String | HTMLElement | Array&gt;</code>
Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Array
</code></dt>
<dd>The XY position of the element(s)</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_getY">getY</a></h4>
<div class="detail">
<code>
Number | Array
<strong>getY</strong>
(
el
)
</code>
<div class="description">
Gets the current Y position of an element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>el &lt;String | HTMLElement | Array&gt;</code>
Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Number | Array
</code></dt>
<dd>The Y position of the element(s)</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_hasClass">hasClass</a></h4>
<div class="detail">
<code>
Boolean | Array
<strong>hasClass</strong>
(
el
,
className
)
</code>
<div class="description">
Determines whether an HTMLElement has the given className.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>el &lt;String | HTMLElement | Array&gt;</code>
The element or collection to test
</dd>
<dd>
<code>className &lt;String&gt;</code>
the class name to search for
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Boolean | Array
</code></dt>
<dd>A boolean value or array of boolean values</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_inDocument">inDocument</a></h4>
<div class="detail">
<code>
Boolean
<strong>inDocument</strong>
(
el
)
</code>
<div class="description">
Determines whether an HTMLElement is present in the current document.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>el &lt;String | HTMLElement&gt;</code>
The element to search for
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Boolean
</code></dt>
<dd>Whether or not the element is present in the current document</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_insertAfter">insertAfter</a></h4>
<div class="detail">
<code>
HTMLElement
<strong>insertAfter</strong>
(
newNode
,
referenceNode
)
</code>
<div class="description">
Inserts the new node as the next sibling of the reference node
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>newNode &lt;String | HTMLElement&gt;</code>
The node to be inserted
</dd>
<dd>
<code>referenceNode &lt;String | HTMLElement&gt;</code>
The node to insert the new node after
</dd>
</dl>
<dl>
<dt>Returns:
<code>
HTMLElement
</code></dt>
<dd>The node that was inserted (or null if insert fails)</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_insertBefore">insertBefore</a></h4>
<div class="detail">
<code>
HTMLElement
<strong>insertBefore</strong>
(
newNode
,
referenceNode
)
</code>
<div class="description">
Inserts the new node as the previous sibling of the reference node
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>newNode &lt;String | HTMLElement&gt;</code>
The node to be inserted
</dd>
<dd>
<code>referenceNode &lt;String | HTMLElement&gt;</code>
The node to insert the new node before
</dd>
</dl>
<dl>
<dt>Returns:
<code>
HTMLElement
</code></dt>
<dd>The node that was inserted (or null if insert fails)</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_isAncestor">isAncestor</a></h4>
<div class="detail">
<code>
Boolean
<strong>isAncestor</strong>
(
haystack
,
needle
)
</code>
<div class="description">
Determines whether an HTMLElement is an ancestor of another HTML element in the DOM hierarchy.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>haystack &lt;String | HTMLElement&gt;</code>
The possible ancestor
</dd>
<dd>
<code>needle &lt;String | HTMLElement&gt;</code>
The possible descendent
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Boolean
</code></dt>
<dd>Whether or not the haystack is an ancestor of needle</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_removeClass">removeClass</a></h4>
<div class="detail">
<code>
Boolean | Array
<strong>removeClass</strong>
(
el
,
className
)
</code>
<div class="description">
Removes a class name from a given element or collection of elements.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>el &lt;String | HTMLElement | Array&gt;</code>
The element or collection to remove the class from
</dd>
<dd>
<code>className &lt;String&gt;</code>
the class name to remove from the class attribute
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Boolean | Array
</code></dt>
<dd>A pass/fail boolean or array of booleans</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_replaceClass">replaceClass</a></h4>
<div class="detail">
<code>
Boolean | Array
<strong>replaceClass</strong>
(
el
,
oldClassName
,
newClassName
)
</code>
<div class="description">
Replace a class with another class for a given element or collection of elements.
If no oldClassName is present, the newClassName is simply added.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>el &lt;String | HTMLElement | Array&gt;</code>
The element or collection to remove the class from
</dd>
<dd>
<code>oldClassName &lt;String&gt;</code>
the class name to be replaced
</dd>
<dd>
<code>newClassName &lt;String&gt;</code>
the class name that will be replacing the old class name
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Boolean | Array
</code></dt>
<dd>A pass/fail boolean or array of booleans</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_setStyle">setStyle</a></h4>
<div class="detail">
<code>
void
<strong>setStyle</strong>
(
el
,
property
,
val
)
</code>
<div class="description">
Wrapper for setting style properties of HTMLElements. Normalizes "opacity" across modern browsers.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>el &lt;String | HTMLElement | Array&gt;</code>
Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
</dd>
<dd>
<code>property &lt;String&gt;</code>
The style property to be set.
</dd>
<dd>
<code>val &lt;String&gt;</code>
The value to apply to the given property.
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_setX">setX</a></h4>
<div class="detail">
<code>
void
<strong>setX</strong>
(
el
,
x
)
</code>
<div class="description">
Set the X position of an html element in page coordinates, regardless of how the element is positioned.
The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>el &lt;String | HTMLElement | Array&gt;</code>
Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
</dd>
<dd>
<code>x &lt;Int&gt;</code>
The value to use as the X coordinate for the element(s).
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_setXY">setXY</a></h4>
<div class="detail">
<code>
void
<strong>setXY</strong>
(
el
,
pos
,
noRetry
)
</code>
<div class="description">
Set the position of an html element in page coordinates, regardless of how the element is positioned.
The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>el &lt;String | HTMLElement | Array&gt;</code>
Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
</dd>
<dd>
<code>pos &lt;Array&gt;</code>
Contains X & Y values for new position (coordinates are page-based)
</dd>
<dd>
<code>noRetry &lt;Boolean&gt;</code>
By default we try and set the position a second time if the first fails
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_setY">setY</a></h4>
<div class="detail">
<code>
void
<strong>setY</strong>
(
el
,
x
)
</code>
<div class="description">
Set the Y position of an html element in page coordinates, regardless of how the element is positioned.
The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>el &lt;String | HTMLElement | Array&gt;</code>
Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
</dd>
<dd>
<code>x &lt;Int&gt;</code>
To use as the Y coordinate for the element(s).
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
</div>
</div>
</div>
</div>
</div>
<div class="yui-b">
<div class="nav">
<div class="module">
<h4>Modules</h4>
<ul class="content">
<li class=""><a href="module_animation.html">animation</a></li>
<li class=""><a href="module_autocomplete.html">autocomplete</a></li>
<li class=""><a href="module_button.html">button</a></li>
<li class=""><a href="module_calendar.html">calendar</a></li>
<li class=""><a href="module_charts.html">charts</a></li>
<li class=""><a href="module_colorpicker.html">colorpicker</a></li>
<li class=""><a href="module_connection.html">connection</a></li>
<li class=""><a href="module_container.html">container</a></li>
<li class=""><a href="module_cookie.html">cookie</a></li>
<li class=""><a href="module_datasource.html">datasource</a></li>
<li class=""><a href="module_datatable.html">datatable</a></li>
<li class="selected"><a href="module_dom.html">dom</a></li>
<li class=""><a href="module_dragdrop.html">dragdrop</a></li>
<li class=""><a href="module_editor.html">editor</a></li>
<li class=""><a href="module_element.html">element</a></li>
<li class=""><a href="module_event.html">event</a></li>
<li class=""><a href="module_get.html">get</a></li>
<li class=""><a href="module_history.html">history</a></li>
<li class=""><a href="module_imagecropper.html">imagecropper</a></li>
<li class=""><a href="module_imageloader.html">imageloader</a></li>
<li class=""><a href="module_json.html">json</a></li>
<li class=""><a href="module_layout.html">layout</a></li>
<li class=""><a href="module_logger.html">logger</a></li>
<li class=""><a href="module_menu.html">menu</a></li>
<li class=""><a href="module_profiler.html">profiler</a></li>
<li class=""><a href="module_profilerviewer.html">profilerviewer</a></li>
<li class=""><a href="module_resize.html">resize</a></li>
<li class=""><a href="module_selector.html">selector</a></li>
<li class=""><a href="module_slider.html">slider</a></li>
<li class=""><a href="module_tabview.html">tabview</a></li>
<li class=""><a href="module_treeview.html">treeview</a></li>
<li class=""><a href="module_uploader.html">uploader</a></li>
<li class=""><a href="module_yahoo.html">yahoo</a></li>
<li class=""><a href="module_yuiloader.html">yuiloader</a></li>
<li class=""><a href="module_yuitest.html">yuitest</a></li>
</ul>
</div>
<div class="module">
<h4>Classes</h4>
<ul class="content">
<li class="selected"><a href="YAHOO.util.Dom.html">YAHOO.util.Dom</a></li>
<li class=""><a href="YAHOO.util.Point.html">YAHOO.util.Point</a></li>
<li class=""><a href="YAHOO.util.Region.html">YAHOO.util.Region</a></li>
</ul>
</div>
<div class="module">
<h4>Files</h4>
<ul class="content">
<li class=""><a href="Dom.js.html">Dom.js</a></li>
<li class=""><a href="Region.js.html">Region.js</a></li>
</ul>
</div>
<div class="module">
<h4>Methods</h4>
<ul class="content">
<li class=""><!--<code>Boolean | Array</code>-->
<a href="#method_addClass">addClass</a>
</li>
<li class=""><!--<code>Any | Array</code>-->
<a href="#method_batch">batch</a>
</li>
<li class=""><!--<code>String | Array</code>-->
<a href="#method_generateId">generateId</a>
</li>
<li class=""><!--<code>HTMLElement | Array</code>-->
<a href="#method_get">get</a>
</li>
<li class=""><!--<code>Object</code>-->
<a href="#method_getAncestorBy">getAncestorBy</a>
</li>
<li class=""><!--<code>Object</code>-->
<a href="#method_getAncestorByClassName">getAncestorByClassName</a>
</li>
<li class=""><!--<code>Object</code>-->
<a href="#method_getAncestorByTagName">getAncestorByTagName</a>
</li>
<li class=""><!--<code>Array</code>-->
<a href="#method_getChildren">getChildren</a>
</li>
<li class=""><!--<code>Array</code>-->
<a href="#method_getChildrenBy">getChildrenBy</a>
</li>
<li class=""><!--<code>Int</code>-->
<a href="#method_getClientHeight">getClientHeight</a>
</li>
<li class=""><!--<code>Region</code>-->
<a href="#method_getClientRegion">getClientRegion</a>
</li>
<li class=""><!--<code>Int</code>-->
<a href="#method_getClientWidth">getClientWidth</a>
</li>
<li class=""><!--<code>Int</code>-->
<a href="#method_getDocumentHeight">getDocumentHeight</a>
</li>
<li class=""><!--<code>Int</code>-->
<a href="#method_getDocumentScrollLeft">getDocumentScrollLeft</a>
</li>
<li class=""><!--<code>Int</code>-->
<a href="#method_getDocumentScrollTop">getDocumentScrollTop</a>
</li>
<li class=""><!--<code>Int</code>-->
<a href="#method_getDocumentWidth">getDocumentWidth</a>
</li>
<li class=""><!--<code>Array</code>-->
<a href="#method_getElementsBy">getElementsBy</a>
</li>
<li class=""><!--<code>Array</code>-->
<a href="#method_getElementsByClassName">getElementsByClassName</a>
</li>
<li class=""><!--<code>Object</code>-->
<a href="#method_getFirstChild">getFirstChild</a>
</li>
<li class=""><!--<code>Object</code>-->
<a href="#method_getFirstChildBy">getFirstChildBy</a>
</li>
<li class=""><!--<code>Object</code>-->
<a href="#method_getLastChild">getLastChild</a>
</li>
<li class=""><!--<code>Object</code>-->
<a href="#method_getLastChildBy">getLastChildBy</a>
</li>
<li class=""><!--<code>Object</code>-->
<a href="#method_getNextSibling">getNextSibling</a>
</li>
<li class=""><!--<code>Object</code>-->
<a href="#method_getNextSiblingBy">getNextSiblingBy</a>
</li>
<li class=""><!--<code>Object</code>-->
<a href="#method_getPreviousSibling">getPreviousSibling</a>
</li>
<li class=""><!--<code>Object</code>-->
<a href="#method_getPreviousSiblingBy">getPreviousSiblingBy</a>
</li>
<li class=""><!--<code>Region | Array</code>-->
<a href="#method_getRegion">getRegion</a>
</li>
<li class=""><!--<code>String | Array</code>-->
<a href="#method_getStyle">getStyle</a>
</li>
<li class=""><!--<code>Int</code>-->
<a href="#method_getViewportHeight">getViewportHeight</a>
</li>
<li class=""><!--<code>Int</code>-->
<a href="#method_getViewportWidth">getViewportWidth</a>
</li>
<li class=""><!--<code>Number | Array</code>-->
<a href="#method_getX">getX</a>
</li>
<li class=""><!--<code>Array</code>-->
<a href="#method_getXY">getXY</a>
</li>
<li class=""><!--<code>Number | Array</code>-->
<a href="#method_getY">getY</a>
</li>
<li class=""><!--<code>Boolean | Array</code>-->
<a href="#method_hasClass">hasClass</a>
</li>
<li class=""><!--<code>Boolean</code>-->
<a href="#method_inDocument">inDocument</a>
</li>
<li class=""><!--<code>HTMLElement</code>-->
<a href="#method_insertAfter">insertAfter</a>
</li>
<li class=""><!--<code>HTMLElement</code>-->
<a href="#method_insertBefore">insertBefore</a>
</li>
<li class=""><!--<code>Boolean</code>-->
<a href="#method_isAncestor">isAncestor</a>
</li>
<li class=""><!--<code>Boolean | Array</code>-->
<a href="#method_removeClass">removeClass</a>
</li>
<li class=""><!--<code>Boolean | Array</code>-->
<a href="#method_replaceClass">replaceClass</a>
</li>
<li class=""><!--<code>void</code>-->
<a href="#method_setStyle">setStyle</a>
</li>
<li class=""><!--<code>void</code>-->
<a href="#method_setX">setX</a>
</li>
<li class=""><!--<code>void</code>-->
<a href="#method_setXY">setXY</a>
</li>
<li class=""><!--<code>void</code>-->
<a href="#method_setY">setY</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div id="ft">
<hr />
Copyright &copy; 2007 Yahoo! Inc. All rights reserved.
</div>
</div>
</body>
</html>