webgui/www/extras/yui/docs/YAHOO.util.Event.html
2007-07-05 04:23:55 +00:00

2529 lines
123 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>API: event YAHOO.util.Event (YUI Library)</title>
<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>Event Utility&nbsp; <span class="subtitle">2.2.2</span></h3>
<p>
<a href="./index.html">Yahoo! UI Library</a>
&gt; <a href="./module_event.html">event</a>
&gt; YAHOO.util.Event
</p>
</div>
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<h2>
<code>static</code>
Class <b>YAHOO.util.Event</b>
<span class="extends">
</span>
<span class="extends">
</span>
</code>
</h2>
<!-- class tree goes here -->
<div class="summary description">
The event utility provides functions to add and remove event listeners,
event cleansing. It also tries to automatically remove listeners it
registers during the unload event.
</div>
<div class="section field details">
<h3><a name="field_detail">Properties</a></h3>
<div class="content">
<h4><a name="_interval">_interval</a>
<code>- private object</code>
</h4>
<div class="detail">
<div class="description">
poll handle
</div>
</div>
<hr />
<h4><a name="ADJ_SCOPE">ADJ_SCOPE</a>
<code>- static final int</code>
</h4>
<div class="detail">
<div class="description">
Adjusted scope, either the element we are registering the event
on or the custom object passed in by the listener, int constant
</div>
</div>
<hr />
<h4><a name="counter">counter</a>
<code>- private static object</code>
</h4>
<div class="detail">
<div class="description">
Counter for auto id generation
</div>
</div>
<hr />
<h4><a name="DOMReady">DOMReady</a>
<code>- private static boolean</code>
</h4>
<div class="detail">
<div class="description">
True when the document is initially usable
</div>
</div>
<hr />
<h4><a name="EL">EL</a>
<code>- static final int</code>
</h4>
<div class="detail">
<div class="description">
Element to bind, int constant
</div>
</div>
<hr />
<h4><a name="elCache
DOM element cache">elCache
DOM element cache</a>
<code>- private static object</code>
</h4>
<div class="detail">
<div class="description">
</div>
</div>
<div class="deprecated">
<strong>Deprecated: </strong>Elements are not cached any longer
</div>
<hr />
<h4><a name="FN">FN</a>
<code>- static final int</code>
</h4>
<div class="detail">
<div class="description">
Function to execute, int constant
</div>
</div>
<hr />
<h4><a name="isIE">isIE</a>
<code>- private static object</code>
</h4>
<div class="detail">
<div class="description">
IE detection needed to properly calculate pageX and pageY.
capabilities checking didn't seem to work because another
browser that does not provide the properties have the values
calculated in a different manner than IE.
</div>
</div>
<hr />
<h4><a name="isSafari">isSafari</a>
<code>- private static object</code>
</h4>
<div class="detail">
<div class="description">
Safari detection is necessary to work around the preventDefault
bug that makes it so you can't cancel a href click from the
handler. Since this function has been used outside of this
utility, it was changed to detect all KHTML browser to be more
friendly towards the non-Safari browsers that share the engine.
Internally, the preventDefault bug detection now uses the
webkit property.
</div>
</div>
<div class="deprecated">
<strong>Deprecated: </strong>&#160;
</div>
<hr />
<h4><a name="lastError">lastError</a>
<code>- Error</code>
</h4>
<div class="detail">
<div class="description">
addListener/removeListener can throw errors in unexpected scenarios.
These errors are suppressed, the method returns false, and this property
is set
</div>
</div>
<hr />
<h4><a name="legacyEvents">legacyEvents</a>
<code>- private static object</code>
</h4>
<div class="detail">
<div class="description">
Cache of DOM0 event handlers to work around issues with DOM2 events
in Safari
</div>
</div>
<hr />
<h4><a name="legacyHandlers">legacyHandlers</a>
<code>- private static object</code>
</h4>
<div class="detail">
<div class="description">
Listener stack for DOM0 events
</div>
</div>
<hr />
<h4><a name="legacyMap">legacyMap</a>
<code>- private static object</code>
</h4>
<div class="detail">
<div class="description">
Lookup table for legacy events
</div>
</div>
<hr />
<h4><a name="listeners">listeners</a>
<code>- private static array</code>
</h4>
<div class="detail">
<div class="description">
Cache of wrapped listeners
</div>
</div>
<hr />
<h4><a name="loadComplete">loadComplete</a>
<code>- private static boolean</code>
</h4>
<div class="detail">
<div class="description">
True after the onload event has fired
</div>
</div>
<hr />
<h4><a name="OBJ">OBJ</a>
<code>- static final int</code>
</h4>
<div class="detail">
<div class="description">
Object passed in by the user that will be returned as a
parameter to the callback, int constant
</div>
</div>
<hr />
<h4><a name="onAvailStack">onAvailStack</a>
<code>- private static object</code>
</h4>
<div class="detail">
<div class="description">
onAvailable listeners
</div>
</div>
<hr />
<h4><a name="POLL_INTERVAL">POLL_INTERVAL</a>
<code>- static final int</code>
</h4>
<div class="detail">
<div class="description">
The poll interval in milliseconds
</div>
</div>
<hr />
<h4><a name="POLL_RETRYS">POLL_RETRYS</a>
<code>- static final int</code>
</h4>
<div class="detail">
<div class="description">
The number of times we should look for elements that are not
in the DOM at the time the event is requested after the document
has been loaded. The default is 200@amp;50 ms, so it will poll
for 10 seconds or until all outstanding handlers are bound
(whichever comes first).
</div>
</div>
<hr />
<h4><a name="retryCount">retryCount</a>
<code>- private static object</code>
</h4>
<div class="detail">
<div class="description">
The number of times to poll after window.onload. This number is
increased if additional late-bound handlers are requested after
the page load.
</div>
</div>
<hr />
<h4><a name="TYPE">TYPE</a>
<code>- static final int</code>
</h4>
<div class="detail">
<div class="description">
Type of event, int constant
</div>
</div>
<hr />
<h4><a name="unloadListeners">unloadListeners</a>
<code>- private static array</code>
</h4>
<div class="detail">
<div class="description">
User-defined unload function that will be fired before all events
are detached
</div>
</div>
<hr />
<h4><a name="webkit">webkit</a>
<code>- static string</code>
</h4>
<div class="detail">
<div class="description">
If WebKit is detected, we keep track of the version number of
the engine. The webkit property will contain a string with
the webkit version number if webkit is detected, null
otherwise.
Safari 1.3.2 (312.6): 312.8.1 <-- currently the latest
available on Mac OSX 10.3.
Safari 2.0.2: 416 <-- hasOwnProperty introduced
Safari 2.0.4: 418 <-- preventDefault fixed (I believe)
Safari 2.0.4 (419.3): 418.9.1 <-- current release
http://developer.apple.com/internet/safari/uamatrix.html
</div>
</div>
<hr />
<h4><a name="WFN">WFN</a>
<code>- static final int</code>
</h4>
<div class="detail">
<div class="description">
Function wrapped for scope correction and cleanup, int constant
</div>
</div>
<hr />
</div>
</div>
<div class="section method details">
<h3><a name="methodDetails">Methods</a></h3>
<div class="content">
<h4>
<a name="_getCacheIndex">_getCacheIndex</a></h4>
<div class="detail">
<code>
private
static
void
<strong>_getCacheIndex</strong>
(
)
</code>
<div class="description">
Locating the saved event handler data by function ref
</div>
<div class="description">
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="_getScroll">_getScroll</a></h4>
<div class="detail">
<code>
private
static
void
<strong>_getScroll</strong>
(
)
</code>
<div class="description">
Returns the scrollTop and scrollLeft. Used to calculate the
pageX and pageY in Internet Explorer
</div>
<div class="description">
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="_getScrollLeft">_getScrollLeft</a></h4>
<div class="detail">
<code>
private
static
void
<strong>_getScrollLeft</strong>
(
)
</code>
<div class="description">
Returns scrollLeft
</div>
<div class="description">
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="_getScrollTop">_getScrollTop</a></h4>
<div class="detail">
<code>
private
static
void
<strong>_getScrollTop</strong>
(
)
</code>
<div class="description">
Returns scrollTop
</div>
<div class="description">
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="_isValidCollection">_isValidCollection</a></h4>
<div class="detail">
<code>
private
static
boolean
<strong>_isValidCollection</strong>
(
o
)
</code>
<div class="description">
We want to be able to use getElementsByTagName as a collection
to attach a group of events to. Unfortunately, different
browsers return different types of collections. This function
tests to determine if the object is array-like. It will also
fail if the object is an array, but is empty.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>o &lt;object&gt;</code>
the object to test
</dd>
</dl>
<dl>
<dt>Returns:
<code>
boolean
</code></dt>
<dd>true if the object is array-like and populated</dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="_load">_load</a></h4>
<div class="detail">
<code>
private
static
void
<strong>_load</strong>
(
)
</code>
<div class="description">
hook up any deferred listeners
</div>
<div class="description">
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="_ready">_ready</a></h4>
<div class="detail">
<code>
private
static
void
<strong>_ready</strong>
(
)
</code>
<div class="description">
Fires the DOMReady event listeners the first time the document is
usable.
</div>
<div class="description">
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="_simpleAdd">_simpleAdd</a></h4>
<div class="detail">
<code>
private
static
void
<strong>_simpleAdd</strong>
(
el
,
sType
,
fn
,
capture
)
</code>
<div class="description">
Adds a DOM event directly without the caching, cleanup, scope adj, etc
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>el &lt;HTMLElement&gt;</code>
the element to bind the handler to
</dd>
<dd>
<code>sType &lt;string&gt;</code>
the type of event handler
</dd>
<dd>
<code>fn &lt;function&gt;</code>
the callback to invoke
</dd>
<dd>
<code>capture &lt;boolen&gt;</code>
capture or bubble phase
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="_simpleRemove">_simpleRemove</a></h4>
<div class="detail">
<code>
private
static
void
<strong>_simpleRemove</strong>
(
el
,
sType
,
fn
,
capture
)
</code>
<div class="description">
Basic remove listener
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>el &lt;HTMLElement&gt;</code>
the element to bind the handler to
</dd>
<dd>
<code>sType &lt;string&gt;</code>
the type of event handler
</dd>
<dd>
<code>fn &lt;function&gt;</code>
the callback to invoke
</dd>
<dd>
<code>capture &lt;boolen&gt;</code>
capture or bubble phase
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="_tryPreloadAttach">_tryPreloadAttach</a></h4>
<div class="detail">
<code>
private
static
void
<strong>_tryPreloadAttach</strong>
(
)
</code>
<div class="description">
Polling function that runs before the onload event fires,
attempting to attach to DOM Nodes as soon as they are
available
</div>
<div class="description">
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="_unload">_unload</a></h4>
<div class="detail">
<code>
private
static
void
<strong>_unload</strong>
(
)
</code>
<div class="description">
Removes all listeners registered by pe.event. Called
automatically during the unload event.
</div>
<div class="description">
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="addListener">addListener</a></h4>
<div class="detail">
<code>
static
boolean
<strong>addListener</strong>
(
el
,
sType
,
fn
,
obj
,
override
)
</code>
<div class="description">
Appends an event handler
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>el &lt;Object&gt;</code>
The html element to assign the
event to
</dd>
<dd>
<code>sType &lt;String&gt;</code>
The type of event to append
</dd>
<dd>
<code>fn &lt;Function&gt;</code>
The method the event invokes
</dd>
<dd>
<code>obj &lt;Object&gt;</code>
An arbitrary object that will be
passed as a parameter to the handler
</dd>
<dd>
<code>override &lt;boolean&gt;</code>
If true, the obj passed in becomes
the execution scope of the listener
</dd>
</dl>
<dl>
<dt>Returns:
<code>
boolean
</code></dt>
<dd>True if the action was successful or defered,
false if one or more of the elements
could not have the listener attached,
or if the operation throws an exception.</dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="clearCache">clearCache</a></h4>
<div class="detail">
<code>
private
static
void
<strong>clearCache</strong>
(
)
</code>
<div class="description">
Clears the element cache
</div>
<div class="description">
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
<div class="deprecated">
<strong>Deprecated</strong> Elements are not cached any longer
</div>
</div>
</div>
<hr />
<h4>
<a name="fireLegacyEvent">fireLegacyEvent</a></h4>
<div class="detail">
<code>
private
static
void
<strong>fireLegacyEvent</strong>
(
)
</code>
<div class="description">
When using legacy events, the handler is routed to this object
so we can fire our custom listener stack.
</div>
<div class="description">
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="generateId">generateId</a></h4>
<div class="detail">
<code>
static
string
<strong>generateId</strong>
(
el
)
</code>
<div class="description">
Generates an unique ID for the element if it does not already
have one.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>el &lt;object&gt;</code>
the element to create the id for
</dd>
</dl>
<dl>
<dt>Returns:
<code>
string
</code></dt>
<dd>the resulting id of the element</dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="getCharCode">getCharCode</a></h4>
<div class="detail">
<code>
static
int
<strong>getCharCode</strong>
(
ev
)
</code>
<div class="description">
Returns the charcode for an event
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>ev &lt;Event&gt;</code>
the event
</dd>
</dl>
<dl>
<dt>Returns:
<code>
int
</code></dt>
<dd>the event's charCode</dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="getEl">getEl</a></h4>
<div class="detail">
<code>
private
static
void
<strong>getEl</strong>
(
)
</code>
<div class="description">
We cache elements bound by id because when the unload event
fires, we can no longer use document.getElementById
</div>
<div class="description">
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
<div class="deprecated">
<strong>Deprecated</strong> Elements are not cached any longer
</div>
</div>
</div>
<hr />
<h4>
<a name="getEvent">getEvent</a></h4>
<div class="detail">
<code>
static
Event
<strong>getEvent</strong>
(
e
)
</code>
<div class="description">
Finds the event in the window object, the caller's arguments, or
in the arguments of another method in the callstack. This is
executed automatically for events registered through the event
manager, so the implementer should not normally need to execute
this function at all.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>e &lt;Event&gt;</code>
the event parameter from the handler
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Event
</code></dt>
<dd>the event</dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="getLegacyIndex">getLegacyIndex</a></h4>
<div class="detail">
<code>
private
static
void
<strong>getLegacyIndex</strong>
(
)
</code>
<div class="description">
Returns the legacy event index that matches the supplied
signature
</div>
<div class="description">
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="getListeners">getListeners</a></h4>
<div class="detail">
<code>
static
Object
<strong>getListeners</strong>
(
el
,
sType
)
</code>
<div class="description">
Returns all listeners attached to the given element via addListener.
Optionally, you can specify a specific type of event to return.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>el &lt;HTMLElement&gt;</code>
the element to inspect
</dd>
<dd>
<code>sType &lt;string&gt;</code>
optional type of listener to return. If
left out, all listeners will be returned
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Object
</code></dt>
<dd>the listener. Contains the following fields:
&nbsp;&nbsp;type: (string) the type of event
&nbsp;&nbsp;fn: (function) the callback supplied to addListener
&nbsp;&nbsp;obj: (object) the custom object supplied to addListener
&nbsp;&nbsp;adjust: (boolean) whether or not to adjust the default scope
&nbsp;&nbsp;index: (int) its position in the Event util listener cache</dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="getPageX">getPageX</a></h4>
<div class="detail">
<code>
static
int
<strong>getPageX</strong>
(
ev
)
</code>
<div class="description">
Returns the event's pageX
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>ev &lt;Event&gt;</code>
the event
</dd>
</dl>
<dl>
<dt>Returns:
<code>
int
</code></dt>
<dd>the event's pageX</dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="getPageY">getPageY</a></h4>
<div class="detail">
<code>
static
int
<strong>getPageY</strong>
(
ev
)
</code>
<div class="description">
Returns the event's pageY
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>ev &lt;Event&gt;</code>
the event
</dd>
</dl>
<dl>
<dt>Returns:
<code>
int
</code></dt>
<dd>the event's pageY</dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="getRelatedTarget">getRelatedTarget</a></h4>
<div class="detail">
<code>
static
HTMLElement
<strong>getRelatedTarget</strong>
(
ev
)
</code>
<div class="description">
Returns the event's related target
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>ev &lt;Event&gt;</code>
the event
</dd>
</dl>
<dl>
<dt>Returns:
<code>
HTMLElement
</code></dt>
<dd>the event's relatedTarget</dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="getTarget">getTarget</a></h4>
<div class="detail">
<code>
static
HTMLElement
<strong>getTarget</strong>
(
ev
,
resolveTextNode
)
</code>
<div class="description">
Returns the event's target element
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>ev &lt;Event&gt;</code>
the event
</dd>
<dd>
<code>resolveTextNode &lt;boolean&gt;</code>
when set to true the target's
parent will be returned if the target is a
text node. @deprecated, the text node is
now resolved automatically
</dd>
</dl>
<dl>
<dt>Returns:
<code>
HTMLElement
</code></dt>
<dd>the event's target</dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="getTime">getTime</a></h4>
<div class="detail">
<code>
static
Date
<strong>getTime</strong>
(
ev
)
</code>
<div class="description">
Returns the time of the event. If the time is not included, the
event is modified using the current time.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>ev &lt;Event&gt;</code>
the event
</dd>
</dl>
<dl>
<dt>Returns:
<code>
Date
</code></dt>
<dd>the time of the event</dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="getXY">getXY</a></h4>
<div class="detail">
<code>
static
[x, y]
<strong>getXY</strong>
(
ev
)
</code>
<div class="description">
Returns the pageX and pageY properties as an indexed array.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>ev &lt;Event&gt;</code>
the event
</dd>
</dl>
<dl>
<dt>Returns:
<code>
[x, y]
</code></dt>
<dd>the pageX and pageY properties of the event</dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="on">on</a></h4>
<div class="detail">
<code>
static
void
<strong>on</strong>
(
)
</code>
<div class="description">
YAHOO.util.Event.on is an alias for addListener
</div>
<div class="description">
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="onAvailable">onAvailable</a></h4>
<div class="detail">
<code>
static
void
<strong>onAvailable</strong>
(
p_id
,
p_fn
,
p_obj
,
p_override
)
</code>
<div class="description">
Executes the supplied callback when the item with the supplied
id is found. This is meant to be used to execute behavior as
soon as possible as the page loads. If you use this after the
initial page load it will poll for a fixed time for the element.
The number of times it will poll and the frequency are
configurable. By default it will poll for 10 seconds.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>p_id &lt;string&gt;</code>
the id of the element to look for.
</dd>
<dd>
<code>p_fn &lt;function&gt;</code>
what to execute when the element is found.
</dd>
<dd>
<code>p_obj &lt;object&gt;</code>
an optional object to be passed back as
a parameter to p_fn.
</dd>
<dd>
<code>p_override &lt;boolean&gt;</code>
If set to true, p_fn will execute
in the scope of p_obj
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="onContentReady">onContentReady</a></h4>
<div class="detail">
<code>
static
void
<strong>onContentReady</strong>
(
p_id
,
p_fn
,
p_obj
,
p_override
)
</code>
<div class="description">
Works the same way as onAvailable, but additionally checks the
state of sibling elements to determine if the content of the
available element is safe to modify.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>p_id &lt;string&gt;</code>
the id of the element to look for.
</dd>
<dd>
<code>p_fn &lt;function&gt;</code>
what to execute when the element is ready.
</dd>
<dd>
<code>p_obj &lt;object&gt;</code>
an optional object to be passed back as
a parameter to p_fn.
</dd>
<dd>
<code>p_override &lt;boolean&gt;</code>
If set to true, p_fn will execute
in the scope of p_obj
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="onDOMReady">onDOMReady</a></h4>
<div class="detail">
<code>
static
void
<strong>onDOMReady</strong>
(
p_fn
,
p_obj
,
p_scope
)
</code>
<div class="description">
Executes the supplied callback when the DOM is first usable.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>p_fn &lt;function&gt;</code>
what to execute when the element is found.
</dd>
<dd>
<code>p_obj &lt;object&gt;</code>
an optional object to be passed back as
a parameter to p_fn.
</dd>
<dd>
<code>p_scope &lt;boolean&gt;</code>
If set to true, p_fn will execute
in the scope of p_obj, if set to an object it
will execute in the scope of that object
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="preventDefault">preventDefault</a></h4>
<div class="detail">
<code>
static
void
<strong>preventDefault</strong>
(
ev
)
</code>
<div class="description">
Prevents the default behavior of the event
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>ev &lt;Event&gt;</code>
the event
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="purgeElement">purgeElement</a></h4>
<div class="detail">
<code>
static
void
<strong>purgeElement</strong>
(
el
,
recurse
,
sType
)
</code>
<div class="description">
Removes all listeners attached to the given element via addListener.
Optionally, the node's children can also be purged.
Optionally, you can specify a specific type of event to remove.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>el &lt;HTMLElement&gt;</code>
the element to purge
</dd>
<dd>
<code>recurse &lt;boolean&gt;</code>
recursively purge this element's children
as well. Use with caution.
</dd>
<dd>
<code>sType &lt;string&gt;</code>
optional type of listener to purge. If
left out, all listeners will be removed
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="regCE">regCE</a></h4>
<div class="detail">
<code>
private
void
<strong>regCE</strong>
(
)
</code>
<div class="description">
Used by old versions of CustomEvent, restored for backwards
compatibility
</div>
<div class="description">
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="removeListener">removeListener</a></h4>
<div class="detail">
<code>
static
boolean
<strong>removeListener</strong>
(
el
,
sType
,
fn
)
</code>
<div class="description">
Removes an event handler
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>el &lt;Object&gt;</code>
the html element or the id of the element to
assign the event to.
</dd>
<dd>
<code>sType &lt;String&gt;</code>
the type of event to remove.
</dd>
<dd>
<code>fn &lt;Function&gt;</code>
the method the event invokes. If fn is
undefined, then all event handlers for the type of event are
removed.
</dd>
</dl>
<dl>
<dt>Returns:
<code>
boolean
</code></dt>
<dd>true if the unbind was successful, false
otherwise.</dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="resolveTextNode">resolveTextNode</a></h4>
<div class="detail">
<code>
static
HTMLElement
<strong>resolveTextNode</strong>
(
node
)
</code>
<div class="description">
In some cases, some browsers will return a text node inside
the actual element that was targeted. This normalizes the
return value for getTarget and getRelatedTarget.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>node &lt;HTMLElement&gt;</code>
node to resolve
</dd>
</dl>
<dl>
<dt>Returns:
<code>
HTMLElement
</code></dt>
<dd>the normized node</dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="startInterval">startInterval</a></h4>
<div class="detail">
<code>
private
static
void
<strong>startInterval</strong>
(
)
</code>
<div class="description">
</div>
<div class="description">
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="stopEvent">stopEvent</a></h4>
<div class="detail">
<code>
static
void
<strong>stopEvent</strong>
(
ev
)
</code>
<div class="description">
Convenience method for stopPropagation + preventDefault
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>ev &lt;Event&gt;</code>
the event
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="stopPropagation">stopPropagation</a></h4>
<div class="detail">
<code>
static
void
<strong>stopPropagation</strong>
(
ev
)
</code>
<div class="description">
Stops event propagation
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>ev &lt;Event&gt;</code>
the event
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
<h4>
<a name="useLegacyEvent">useLegacyEvent</a></h4>
<div class="detail">
<code>
private
static
void
<strong>useLegacyEvent</strong>
(
)
</code>
<div class="description">
Logic that determines when we should automatically use legacy
events instead of DOM2 events. Currently this is limited to old
Safari browsers with a broken preventDefault
</div>
<div class="description">
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
</div>
</div>
<div class="section method details">
<h3><a name="methodDetails">Events</a></h3>
<div class="content">
<h4>
<a name="DOMReadyEvent">DOMReadyEvent</a></h4>
<div class="detail">
<code>
<strong>DOMReadyEvent</strong>
(
)
</code>
<div class="description">
Custom event the fires when the dom is initially usable
</div>
<div class="description">
</div>
</div>
<hr />
</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_connection.html">connection</a></li>
<li class=""><a href="module_container.html">container</a></li>
<li class=""><a href="module_datasource.html">datasource</a></li>
<li class=""><a href="module_datatable.html">datatable</a></li>
<li class=""><a href="module_dom.html">dom</a></li>
<li class=""><a href="module_dragdrop.html">dragdrop</a></li>
<li class=""><a href="module_element.html">element</a></li>
<li class="selected"><a href="module_event.html">event</a></li>
<li class=""><a href="module_history.html">history</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_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_yahoo.html">yahoo</a></li>
</ul>
</div>
<div class="module">
<h4>Classes</h4>
<ul class="content">
<li class=""><a href="YAHOO.util.CustomEvent.html">YAHOO.util.CustomEvent</a></li>
<li class="selected"><a href="YAHOO.util.Event.html">YAHOO.util.Event</a></li>
<li class=""><a href="YAHOO.util.EventProvider.html">YAHOO.util.EventProvider</a></li>
<li class=""><a href="YAHOO.util.Subscriber.html">YAHOO.util.Subscriber</a></li>
</ul>
</div>
<div class="module">
<h4>Files</h4>
<ul class="content">
<li class=""><a href="CustomEvent.js.html">CustomEvent.js</a></li>
<li class=""><a href="Event.js.html">Event.js</a></li>
<li class=""><a href="EventProvider.js.html">EventProvider.js</a></li>
</ul>
</div>
<div class="module">
<h4>Properties</h4>
<ul class="content">
<li><a href="#_interval">_interval</a>
<!--<code>&lt;int&gt;</code>-->
</li>
<li><a href="#ADJ_SCOPE">ADJ_SCOPE</a>
<!--<code>&lt;int&gt;</code>-->
</li>
<li><a href="#counter">counter</a>
<!--<code>&lt;int&gt;</code>-->
</li>
<li><a href="#DOMReady">DOMReady</a>
<!--<code>&lt;int&gt;</code>-->
</li>
<li><a href="#EL">EL</a>
<!--<code>&lt;int&gt;</code>-->
</li>
<li><a href="#elCache
DOM element cache">elCache
DOM element cache</a>
<!--<code>&lt;int&gt;</code>-->
</li>
<li><a href="#FN">FN</a>
<!--<code>&lt;int&gt;</code>-->
</li>
<li><a href="#isIE">isIE</a>
<!--<code>&lt;int&gt;</code>-->
</li>
<li><a href="#isSafari">isSafari</a>
<!--<code>&lt;int&gt;</code>-->
</li>
<li><a href="#lastError">lastError</a>
<!--<code>&lt;int&gt;</code>-->
</li>
<li><a href="#legacyEvents">legacyEvents</a>
<!--<code>&lt;int&gt;</code>-->
</li>
<li><a href="#legacyHandlers">legacyHandlers</a>
<!--<code>&lt;int&gt;</code>-->
</li>
<li><a href="#legacyMap">legacyMap</a>
<!--<code>&lt;int&gt;</code>-->
</li>
<li><a href="#listeners">listeners</a>
<!--<code>&lt;int&gt;</code>-->
</li>
<li><a href="#loadComplete">loadComplete</a>
<!--<code>&lt;int&gt;</code>-->
</li>
<li><a href="#OBJ">OBJ</a>
<!--<code>&lt;int&gt;</code>-->
</li>
<li><a href="#onAvailStack">onAvailStack</a>
<!--<code>&lt;int&gt;</code>-->
</li>
<li><a href="#POLL_INTERVAL">POLL_INTERVAL</a>
<!--<code>&lt;int&gt;</code>-->
</li>
<li><a href="#POLL_RETRYS">POLL_RETRYS</a>
<!--<code>&lt;int&gt;</code>-->
</li>
<li><a href="#retryCount">retryCount</a>
<!--<code>&lt;int&gt;</code>-->
</li>
<li><a href="#TYPE">TYPE</a>
<!--<code>&lt;int&gt;</code>-->
</li>
<li><a href="#unloadListeners">unloadListeners</a>
<!--<code>&lt;int&gt;</code>-->
</li>
<li><a href="#webkit">webkit</a>
<!--<code>&lt;int&gt;</code>-->
</li>
<li><a href="#WFN">WFN</a>
<!--<code>&lt;int&gt;</code>-->
</li>
</ul>
</div>
<div class="module">
<h4>Methods</h4>
<ul class="content">
<li><!--<code>void</code>-->
<a href="#_getCacheIndex">_getCacheIndex</a>
</li>
<li><!--<code>void</code>-->
<a href="#_getScroll">_getScroll</a>
</li>
<li><!--<code>void</code>-->
<a href="#_getScrollLeft">_getScrollLeft</a>
</li>
<li><!--<code>void</code>-->
<a href="#_getScrollTop">_getScrollTop</a>
</li>
<li><!--<code>boolean</code>-->
<a href="#_isValidCollection">_isValidCollection</a>
</li>
<li><!--<code>void</code>-->
<a href="#_load">_load</a>
</li>
<li><!--<code>void</code>-->
<a href="#_ready">_ready</a>
</li>
<li><!--<code>void</code>-->
<a href="#_simpleAdd">_simpleAdd</a>
</li>
<li><!--<code>void</code>-->
<a href="#_simpleRemove">_simpleRemove</a>
</li>
<li><!--<code>void</code>-->
<a href="#_tryPreloadAttach">_tryPreloadAttach</a>
</li>
<li><!--<code>void</code>-->
<a href="#_unload">_unload</a>
</li>
<li><!--<code>boolean</code>-->
<a href="#addListener">addListener</a>
</li>
<li><!--<code>void</code>-->
<a href="#clearCache">clearCache</a>
</li>
<li><!--<code>void</code>-->
<a href="#fireLegacyEvent">fireLegacyEvent</a>
</li>
<li><!--<code>string</code>-->
<a href="#generateId">generateId</a>
</li>
<li><!--<code>int</code>-->
<a href="#getCharCode">getCharCode</a>
</li>
<li><!--<code>void</code>-->
<a href="#getEl">getEl</a>
</li>
<li><!--<code>Event</code>-->
<a href="#getEvent">getEvent</a>
</li>
<li><!--<code>void</code>-->
<a href="#getLegacyIndex">getLegacyIndex</a>
</li>
<li><!--<code>Object</code>-->
<a href="#getListeners">getListeners</a>
</li>
<li><!--<code>int</code>-->
<a href="#getPageX">getPageX</a>
</li>
<li><!--<code>int</code>-->
<a href="#getPageY">getPageY</a>
</li>
<li><!--<code>HTMLElement</code>-->
<a href="#getRelatedTarget">getRelatedTarget</a>
</li>
<li><!--<code>HTMLElement</code>-->
<a href="#getTarget">getTarget</a>
</li>
<li><!--<code>Date</code>-->
<a href="#getTime">getTime</a>
</li>
<li><!--<code>[x, y]</code>-->
<a href="#getXY">getXY</a>
</li>
<li><!--<code>void</code>-->
<a href="#on">on</a>
</li>
<li><!--<code>void</code>-->
<a href="#onAvailable">onAvailable</a>
</li>
<li><!--<code>void</code>-->
<a href="#onContentReady">onContentReady</a>
</li>
<li><!--<code>void</code>-->
<a href="#onDOMReady">onDOMReady</a>
</li>
<li><!--<code>void</code>-->
<a href="#preventDefault">preventDefault</a>
</li>
<li><!--<code>void</code>-->
<a href="#purgeElement">purgeElement</a>
</li>
<li><!--<code>void</code>-->
<a href="#regCE">regCE</a>
</li>
<li><!--<code>boolean</code>-->
<a href="#removeListener">removeListener</a>
</li>
<li><!--<code>HTMLElement</code>-->
<a href="#resolveTextNode">resolveTextNode</a>
</li>
<li><!--<code>void</code>-->
<a href="#startInterval">startInterval</a>
</li>
<li><!--<code>void</code>-->
<a href="#stopEvent">stopEvent</a>
</li>
<li><!--<code>void</code>-->
<a href="#stopPropagation">stopPropagation</a>
</li>
<li><!--<code>void</code>-->
<a href="#useLegacyEvent">useLegacyEvent</a>
</li>
</ul>
</div>
<div class="module">
<h4>Events</h4>
<ul class="content">
<li>
<a href="#DOMReadyEvent">DOMReadyEvent</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div id="ft">
<hr />
Copyright &copy; 2007 Yahoo! Inc. All rights reserved.
</div>
</div>
</body>
</html>