webgui/www/extras/yui/docs/YAHOO.util.Element.html
JT Smith cfd09a5cb6 upgraded to yui 0.12.0
upgraded to yui-ext 0.33 rc2
2006-11-28 02:23:34 +00:00

1410 lines
72 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>API: tabview YAHOO.util.Element (YUI Library)</title>
<link rel="stylesheet" type="text/css" href="assets/reset-fonts-grids-min.css">
<link rel="stylesheet" type="text/css" href="assets/api.css">
</head>
<body id="yahoo-com">
<div id="doc3" class="yui-t2">
<div id="hd">
<h1>Yahoo! UI Library</h1>
<h3>tabview&nbsp;</h3>
<p>
<a href="./index.html">Yahoo! UI Library</a>
&gt; <a href="./module_tabview.html">tabview</a>
&gt; YAHOO.util.Element
</p>
</div>
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<h2>
Class <b>YAHOO.util.Element</b>
<span class="extends">
</span>
<span class="extends">
- uses
<a href="YAHOO.util.AttributeProvider.html">YAHOO.util.AttributeProvider</a>
</span>
</code>
</h2>
<!-- class tree goes here -->
<div class="summary description">
Element provides an interface to an HTMLElement's attributes and common
methods. Other commonly used attributes are added as well.
</div>
<div class="section constructor details">
<h3><a name="constructor_detail">Constructor</a></h3>
<div class="content">
<div class="detail">
<strong>YAHOO.util.Element</strong>
<code>
(
el
,
map
)
</code>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>el
&lt;HTMLElement | String&gt;
</code>
The html element that
represents the Element.
</dd>
<dd>
<code>map
&lt;Object&gt;
</code>
A key-value map of initial config names and values
</dd>
</dl>
</div>
</div>
</div>
</div>
<div class="section field details">
<h3><a name="field_detail">Properties</a></h3>
<div class="content">
<h4><a name="DOM_EVENTS">DOM_EVENTS</a>
<code>- Object</code>
</h4>
<div class="detail">
<div class="description">
Dom events supported by the Element instance.
</div>
</div>
<hr />
</div>
</div>
<div class="section field inheritance">
<h4>Properties inherited from <a href="YAHOO.util.AttributeProvider.html">YAHOO.util.AttributeProvider</a>:</h4>
<div class="content">
<code>
<a href="YAHOO.util.AttributeProvider.html#_configs">_configs</a>
</code>
</div>
</div>
<div class="section field inheritance">
<h4>Properties inherited from <a href="YAHOO.util.EventProvider.html">YAHOO.util.EventProvider</a>:</h4>
<div class="content">
<code>
<a href="YAHOO.util.EventProvider.html#__yui_events">__yui_events</a>,
<a href="YAHOO.util.EventProvider.html#__yui_subscribers">__yui_subscribers</a>
</code>
</div>
</div>
<div class="section method details">
<h3><a name="methodDetails">Methods</a></h3>
<div class="content">
<h4>
<a name="_registerHTMLAttr">_registerHTMLAttr</a></h4>
<div class="detail">
<code>
private
void
<strong>_registerHTMLAttr</strong>
(
element
,
key
,
map
)
</code>
<div class="description">
Sets the value of the property and fires beforeChange and change events.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>element &lt;YAHOO.util.Element&gt;</code>
The Element instance to
register the config to.
</dd>
<dd>
<code>key &lt;String&gt;</code>
The name of the config to register
</dd>
<dd>
<code>map &lt;Object&gt;</code>
A key-value map of the config's params
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="addClass">addClass</a></h4>
<div class="detail">
<code>
void
<strong>addClass</strong>
(
className
)
</code>
<div class="description">
Wrapper for Dom method.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>className &lt;String&gt;</code>
The className to add
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="addListener">addListener</a></h4>
<div class="detail">
<code>
void
<strong>addListener</strong>
(
type
,
fn
,
obj
,
scope
)
</code>
<div class="description">
Adds a listener for the given event. These may be DOM or
customEvent listeners. Any event that is fired via fireEvent
can be listened for. All handlers receive an event object.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>type &lt;String&gt;</code>
The name of the event to listen for
</dd>
<dd>
<code>fn &lt;Function&gt;</code>
The handler to call when the event fires
</dd>
<dd>
<code>obj &lt;Any&gt;</code>
A variable to pass to the handler
</dd>
<dd>
<code>scope &lt;Object&gt;</code>
The object to use for the scope of the handler
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="appendChild">appendChild</a></h4>
<div class="detail">
<code>
void
<strong>appendChild</strong>
(
deep
)
</code>
<div class="description">
Wrapper for HTMLElement method.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>deep &lt;Boolean&gt;</code>
Whether or not to do a deep clone
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="appendTo">appendTo</a></h4>
<div class="detail">
<code>
void
<strong>appendTo</strong>
(
parentNode
,
before
)
</code>
<div class="description">
Appends the HTMLElement into either the supplied parentNode.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>parentNode &lt;HTMLElement | Element&gt;</code>
The node to append to
</dd>
<dd>
<code>before &lt;HTMLElement | Element&gt;</code>
An optional node to insert before
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="fireQueue">fireQueue</a></h4>
<div class="detail">
<code>
void
<strong>fireQueue</strong>
(
)
</code>
<div class="description">
Apply any queued set calls.
</div>
<div class="description">
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="getElementsByClassName">getElementsByClassName</a></h4>
<div class="detail">
<code>
Array
<strong>getElementsByClassName</strong>
(
className
,
tag
)
</code>
<div class="description">
Wrapper for Dom method.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>className &lt;String&gt;</code>
The className to collect
</dd>
<dd>
<code>tag &lt;String&gt;</code>
(optional) The tag to use in
conjunction with class name
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Array
</code></dt>
<dd>Array of HTMLElements</dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="getElementsByTagName">getElementsByTagName</a></h4>
<div class="detail">
<code>
void
<strong>getElementsByTagName</strong>
(
tag
)
</code>
<div class="description">
Wrapper for HTMLElement method.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>tag &lt;String&gt;</code>
The tagName to collect
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="getStyle">getStyle</a></h4>
<div class="detail">
<code>
String
<strong>getStyle</strong>
(
property
)
</code>
<div class="description">
Wrapper for Dom method.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>property &lt;String&gt;</code>
The style property to retrieve
</dd>
</dl>
<dl>
<dt>Returns:
<code>
String
</code></dt>
<dd>The current value of the property</dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="hasChildNodes">hasChildNodes</a></h4>
<div class="detail">
<code>
Boolean
<strong>hasChildNodes</strong>
(
)
</code>
<div class="description">
Wrapper for HTMLElement method.
</div>
<div class="description">
<dl>
<dt>Returns:
<code>
Boolean
</code></dt>
<dd>Whether or not the element has childNodes</dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="hasClass">hasClass</a></h4>
<div class="detail">
<code>
Boolean
<strong>hasClass</strong>
(
className
)
</code>
<div class="description">
Wrapper for Dom method.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>className &lt;String&gt;</code>
The className to add
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Boolean
</code></dt>
<dd>Whether or not the element has the class name</dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="initAttributes">initAttributes</a></h4>
<div class="detail">
<code>
void
<strong>initAttributes</strong>
(
map
)
</code>
<div class="description">
Registers Element specific attributes.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>map &lt;Object&gt;</code>
A key-value map of initial attribute configs
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="insertBefore">insertBefore</a></h4>
<div class="detail">
<code>
void
<strong>insertBefore</strong>
(
element
,
before
)
</code>
<div class="description">
Wrapper for HTMLElement method.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>element &lt;HTMLElement&gt;</code>
The HTMLElement to insert
</dd>
<dd>
<code>before &lt;HTMLElement&gt;</code>
The HTMLElement to insert
the element before.
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="on">on</a></h4>
<div class="detail">
<code>
void
<strong>on</strong>
(
type
,
fn
,
obj
,
scope
)
</code>
<div class="description">
Alias for addListener
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>type &lt;String&gt;</code>
The name of the event to listen for
</dd>
<dd>
<code>fn &lt;Function&gt;</code>
The function call when the event fires
</dd>
<dd>
<code>obj &lt;Any&gt;</code>
A variable to pass to the handler
</dd>
<dd>
<code>scope &lt;Object&gt;</code>
The object to use for the scope of the handler
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="removeChild">removeChild</a></h4>
<div class="detail">
<code>
void
<strong>removeChild</strong>
(
child
)
</code>
<div class="description">
Wrapper for HTMLElement method.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>child &lt;HTMLElement&gt;</code>
The HTMLElement to remove
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="removeClass">removeClass</a></h4>
<div class="detail">
<code>
void
<strong>removeClass</strong>
(
className
)
</code>
<div class="description">
Wrapper for Dom method.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>className &lt;String&gt;</code>
The className to remove
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="removeListener">removeListener</a></h4>
<div class="detail">
<code>
void
<strong>removeListener</strong>
(
type
,
fn
)
</code>
<div class="description">
Remove an event listener
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>type &lt;String&gt;</code>
The name of the event to listen for
</dd>
<dd>
<code>fn &lt;Function&gt;</code>
The function call when the event fires
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="replaceChild">replaceChild</a></h4>
<div class="detail">
<code>
void
<strong>replaceChild</strong>
(
newNode
,
oldNode
)
</code>
<div class="description">
Wrapper for HTMLElement method.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>newNode &lt;HTMLElement&gt;</code>
The HTMLElement to insert
</dd>
<dd>
<code>oldNode &lt;HTMLElement&gt;</code>
The HTMLElement to replace
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="replaceClass">replaceClass</a></h4>
<div class="detail">
<code>
void
<strong>replaceClass</strong>
(
oldClassName
,
newClassName
)
</code>
<div class="description">
Wrapper for Dom method.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>oldClassName &lt;String&gt;</code>
The className to replace
</dd>
<dd>
<code>newClassName &lt;String&gt;</code>
The className to add
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="setStyle">setStyle</a></h4>
<div class="detail">
<code>
void
<strong>setStyle</strong>
(
property
,
value
)
</code>
<div class="description">
Wrapper for Dom method.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>property &lt;String&gt;</code>
The style property to set
</dd>
<dd>
<code>value &lt;String&gt;</code>
The value to apply to the style property
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
</div>
</div>
<div class="section field inheritance">
<h4>Methods inherited from <a href="YAHOO.util.AttributeProvider.html">YAHOO.util.AttributeProvider</a>:</h4>
<div class="content">
<code>
<a href="YAHOO.util.AttributeProvider.html#configureAttribute">configureAttribute</a>,
<a href="YAHOO.util.AttributeProvider.html#fireBeforeChangeEvent">fireBeforeChangeEvent</a>,
<a href="YAHOO.util.AttributeProvider.html#fireChangeEvent">fireChangeEvent</a>,
<a href="YAHOO.util.AttributeProvider.html#get">get</a>,
<a href="YAHOO.util.AttributeProvider.html#getAttributeConfig">getAttributeConfig</a>,
<a href="YAHOO.util.AttributeProvider.html#getAttributeKeys">getAttributeKeys</a>,
<a href="YAHOO.util.AttributeProvider.html#refresh">refresh</a>,
<a href="YAHOO.util.AttributeProvider.html#register">register</a>,
<a href="YAHOO.util.AttributeProvider.html#resetAttributeConfig">resetAttributeConfig</a>,
<a href="YAHOO.util.AttributeProvider.html#resetValue">resetValue</a>,
<a href="YAHOO.util.AttributeProvider.html#set">set</a>,
<a href="YAHOO.util.AttributeProvider.html#setAttributes">setAttributes</a>
</code>
</div>
</div>
<div class="section field inheritance">
<h4>Methods inherited from <a href="YAHOO.util.EventProvider.html">YAHOO.util.EventProvider</a>:</h4>
<div class="content">
<code>
<a href="YAHOO.util.EventProvider.html#createEvent">createEvent</a>,
<a href="YAHOO.util.EventProvider.html#fireEvent">fireEvent</a>,
<a href="YAHOO.util.EventProvider.html#hasEvent">hasEvent</a>,
<a href="YAHOO.util.EventProvider.html#subscribe">subscribe</a>,
<a href="YAHOO.util.EventProvider.html#unsubscribe">unsubscribe</a>
</code>
</div>
</div>
<div class="section method details">
<h3><a name="methodDetails">Events</a></h3>
<div class="content">
<h4>
<a name="available">available</a></h4>
<div class="detail">
<code>
<strong>available</strong>
(
)
</code>
<div class="description">
Fires when the Element's HTMLElement can be retrieved by Id.
<p>See: <a href="#addListener">Element.addListener</a></p>
<p><strong>Event fields:</strong><br>
<code>&lt;String&gt; type</code> available<br>
<code>&lt;HTMLElement&gt;
target</code> the HTMLElement bound to this Element instance<br>
<p><strong>Usage:</strong><br>
<code>var handler = function(e) {var target = e.target};<br>
myTabs.addListener('available', handler);</code></p>
</div>
<div class="description">
</div>
</div>
<hr />
<h4>
<a name="contentReady">contentReady</a></h4>
<div class="detail">
<code>
<strong>contentReady</strong>
(
)
</code>
<div class="description">
Fires when the Element's HTMLElement subtree is rendered.
<p>See: <a href="#addListener">Element.addListener</a></p>
<p><strong>Event fields:</strong><br>
<code>&lt;String&gt; type</code> contentReady<br>
<code>&lt;HTMLElement&gt;
target</code> the HTMLElement bound to this Element instance<br>
<p><strong>Usage:</strong><br>
<code>var handler = function(e) {var target = e.target};<br>
myTabs.addListener('contentReady', handler);</code></p>
</div>
<div class="description">
</div>
</div>
<hr />
</div>
</div>
<div class="section field details">
<h3><a name="field_detail">Configuration Attributes</a></h3>
<div class="content">
<h4><a name="element">element</a>
<code>- HTMLElement</code>
</h4>
<div class="detail">
<div class="description">
The HTMLElement the Element instance refers to.
</div>
</div>
<hr />
</div>
</div>
</div>
</div>
<div class="yui-b">
<div class="nav">
<div class="module">
<h4>Modules</h4>
<ul class="content">
<li><a href="module_animation.html">animation</a></li>
<li><a href="module_autocomplete.html">autocomplete</a></li>
<li><a href="module_calendar.html">calendar</a></li>
<li><a href="module_connection.html">connection</a></li>
<li><a href="module_container.html">container</a></li>
<li><a href="module_dom.html">dom</a></li>
<li><a href="module_dragdrop.html">dragdrop</a></li>
<li><a href="module_event.html">event</a></li>
<li><a href="module_logger.html">logger</a></li>
<li><a href="module_menu.html">menu</a></li>
<li><a href="module_slider.html">slider</a></li>
<li><a href="module_tabview.html">tabview</a></li>
<li><a href="module_treeview.html">treeview</a></li>
<li><a href="module_yahoo.html">yahoo</a></li>
</ul>
</div>
<div class="module">
<h4>Classes</h4>
<ul class="content">
<li><a href="YAHOO.util.Attribute.html">YAHOO.util.Attribute</a></li>
<li><a href="YAHOO.util.AttributeProvider.html">YAHOO.util.AttributeProvider</a></li>
<li><a href="YAHOO.util.Element.html">YAHOO.util.Element</a></li>
<li><a href="YAHOO.widget.Tab.html">YAHOO.widget.Tab</a></li>
<li><a href="YAHOO.widget.TabView.html">YAHOO.widget.TabView</a></li>
</ul>
</div>
<div class="module">
<h4>Files</h4>
<ul class="content">
<li><a href="Attribute.js.html">Attribute.js</a></li>
<li><a href="AttributeProvider.js.html">AttributeProvider.js</a></li>
<li><a href="Element.js.html">Element.js</a></li>
<li><a href="Lang.js.html">Lang.js</a></li>
<li><a href="Tab.js.html">Tab.js</a></li>
<li><a href="TabView.js.html">TabView.js</a></li>
</ul>
</div>
<div class="module">
<h4>Properties</h4>
<ul class="content">
<li><a href="#DOM_EVENTS">DOM_EVENTS</a>
<!--<code>&lt;Object&gt;</code>-->
</li>
</ul>
</div>
<div class="module">
<h4>Methods</h4>
<ul class="content">
<li><!--<code>void</code>-->
<a href="#_registerHTMLAttr">_registerHTMLAttr</a>
</li>
<li><!--<code>void</code>-->
<a href="#addClass">addClass</a>
</li>
<li><!--<code>void</code>-->
<a href="#addListener">addListener</a>
</li>
<li><!--<code>void</code>-->
<a href="#appendChild">appendChild</a>
</li>
<li><!--<code>void</code>-->
<a href="#appendTo">appendTo</a>
</li>
<li><!--<code>void</code>-->
<a href="#fireQueue">fireQueue</a>
</li>
<li><!--<code>Array</code>-->
<a href="#getElementsByClassName">getElementsByClassName</a>
</li>
<li><!--<code>void</code>-->
<a href="#getElementsByTagName">getElementsByTagName</a>
</li>
<li><!--<code>String</code>-->
<a href="#getStyle">getStyle</a>
</li>
<li><!--<code>Boolean</code>-->
<a href="#hasChildNodes">hasChildNodes</a>
</li>
<li><!--<code>Boolean</code>-->
<a href="#hasClass">hasClass</a>
</li>
<li><!--<code>void</code>-->
<a href="#initAttributes">initAttributes</a>
</li>
<li><!--<code>void</code>-->
<a href="#insertBefore">insertBefore</a>
</li>
<li><!--<code>void</code>-->
<a href="#on">on</a>
</li>
<li><!--<code>void</code>-->
<a href="#removeChild">removeChild</a>
</li>
<li><!--<code>void</code>-->
<a href="#removeClass">removeClass</a>
</li>
<li><!--<code>void</code>-->
<a href="#removeListener">removeListener</a>
</li>
<li><!--<code>void</code>-->
<a href="#replaceChild">replaceChild</a>
</li>
<li><!--<code>void</code>-->
<a href="#replaceClass">replaceClass</a>
</li>
<li><!--<code>void</code>-->
<a href="#setStyle">setStyle</a>
</li>
</ul>
</div>
<div class="module">
<h4>Events</h4>
<ul class="content">
<li>
<a href="#available">available</a>
</li>
<li>
<a href="#contentReady">contentReady</a>
</li>
</ul>
</div>
<div class="module">
<h4>Configuration Attributes</h4>
<ul class="content">
<li>
<a href="#element">element</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div id="ft">
<hr />
Copyright &copy; 2006 Yahoo! Inc. All rights reserved.
</div>
</div>
</body>
</html>