Class YAHOO.util.Event

Object
   |
   +--YAHOO.util.Event

class YAHOO.util.Event

Field Summary [top]

int ADJ_SCOPE
Adjusted scope, either the element we are registering the event on or the custom object passed in by the listener, int constant 
int EL
Element to bind, int constant 
int FN
Function to execute, int constant 
int SCOPE
Object passed in by the user that will be returned as a parameter to the callback, int constant 
int TYPE
Type of event, int constant 
int WFN
Function wrapped for scope correction and cleanup, int constant 

Method Summary [top]

boolean addListener (<Object> el, <String> sType, <Function> fn, <Object> oScope, <boolean> bOverride)
Appends an event handler 
void clearCache ()
Clears the element cache 
int getCharCode (<Event> ev)
Returns the charcode for an event 
Event getEvent (e)
Finds the event in the window object, the caller's arguments, or in the arguments of another method in the callstack. 
int getPageX (<Event> ev)
Returns the event's pageX 
int getPageY (<Event> ev)
Returns the event's pageY 
HTMLElement getRelatedTarget (<Event> ev)
Returns the event's related target 
HTMLElement getTarget (<Event> ev, <boolean> resolveTextNode)
Returns the event's target element 
Date getTime (<Event> ev)
Returns the time of the event. 
void preventDefault (<Event> ev)
Prevents the default behavior of the event 
boolean removeListener (<Object> el, <String> sType, <Function> fn)
Removes an event handler 
void stopEvent (<Event> ev)
Convenience method for stopPropagation + preventDefault 
void stopPropagation (<Event> ev)
Stops event propagation 

Field Detail [top]

ADJ_SCOPE

int   ADJ_SCOPE
Adjusted scope, either the element we are registering the event on or the custom object passed in by the listener, int constant

EL

int   EL
Element to bind, int constant

FN

int   FN
Function to execute, int constant

SCOPE

int   SCOPE
Object passed in by the user that will be returned as a parameter to the callback, int constant

TYPE

int   TYPE
Type of event, int constant

WFN

int   WFN
Function wrapped for scope correction and cleanup, int constant

Constructor Detail [top]

YAHOO.util.Event

YAHOO.util.Event ()

Method Detail [top]

addListener

boolean addListener (<Object> el, <String> sType, <Function> fn, <Object> oScope, <boolean> bOverride)
Appends an event handler
Parameters:
el - The html element to assign the event to
sType - The type of event to append
fn - The method the event invokes
oScope - An arbitrary object that will be passed as a parameter to the handler
bOverride - If true, the obj passed in becomes the execution scope of the listener
Returns:
True if the action was successful or defered, false if one or more of the elements could not have the event bound to it.

clearCache

void clearCache ()
Clears the element cache

getCharCode

int getCharCode (<Event> ev)
Returns the charcode for an event
Parameters:
ev - the event
Returns:
the event's charCode

getEvent

Event getEvent (e)
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.
Parameters:
the - event parameter from the handler
Returns:
the event

getPageX

int getPageX (<Event> ev)
Returns the event's pageX
Parameters:
ev - the event
Returns:
the event's pageX

getPageY

int getPageY (<Event> ev)
Returns the event's pageY
Parameters:
ev - the event
Returns:
the event's pageY

getRelatedTarget

HTMLElement getRelatedTarget (<Event> ev)
Returns the event's related target
Parameters:
ev - the event
Returns:
the event's relatedTarget

getTarget

HTMLElement getTarget (<Event> ev, <boolean> resolveTextNode)
Returns the event's target element
Parameters:
ev - the event
resolveTextNode - when set to true the target's parent will be returned if the target is a text node
Returns:
the event's target

getTime

Date getTime (<Event> ev)
Returns the time of the event. If the time is not included, the event is modified using the current time.
Parameters:
ev - the event
Returns:
the time of the event

preventDefault

void preventDefault (<Event> ev)
Prevents the default behavior of the event
Parameters:
ev - the event

removeListener

boolean removeListener (<Object> el, <String> sType, <Function> fn)
Removes an event handler
Parameters:
el - the html element or the id of the element to assign the event to.
sType - the type of event to remove
fn - the method the event invokes
Returns:
true if the unbind was successful, false otherwise

stopEvent

void stopEvent (<Event> ev)
Convenience method for stopPropagation + preventDefault
Parameters:
ev - the event

stopPropagation

void stopPropagation (<Event> ev)
Stops event propagation
Parameters:
ev - the event