Class ONEGEEK.forms.DOMUtilities


class ONEGEEK.forms.DOMUtilities
General DOM manipulation utilities needed for this library
Defined in ONEGEEK.forms

Function Summary
public void addClass (Object element, Object class)
Add a class name to an element
public void addEvent (DOMElement element, String event, Function handler)
Attach an event to an element.
public Array findPos (Object obj)
Get the x and y coordinates of an element relative to the top left corner of the window
public Boolean hasClass (Object element, Object class)
Check if an element belongs to a certain class
public void removeClass (Object element, Object className)
Remove a class name from an element
public void togglePopup (Object source, Object target)
Popup / Hide an element at the location of the click

Function Details

function addClass

public void addClass(Object element, Object class)
Add a class name to an element
Parameters:
element The element to check
class The class to add to the element
Returns:
void

function addEvent

public void addEvent(DOMElement element, String event, Function handler)
Attach an event to an element. Handles for most browsers NB. To make it work in crappy old browsers assign the element an id
Parameters:
element The element to add the event to
event The type of event i.e. 'click','mouseover'
handler The function handler for the event
Returns:
void

function findPos

public Array findPos(Object obj)
Get the x and y coordinates of an element relative to the top left corner of the window
Parameters:
obj The source element
Returns:
An array containing the x,y coords of obj

function hasClass

public Boolean hasClass(Object element, Object class)
Check if an element belongs to a certain class
Parameters:
element The element to check
class The class to check against the element
Returns:
The result of the operation

function removeClass

public void removeClass(Object element, Object className)
Remove a class name from an element
Parameters:
element The element to check
className The class to remove from the element
Returns:
void

function togglePopup

public void togglePopup(Object source, Object target)
Popup / Hide an element at the location of the click
Parameters:
source The source element that is sending the request
target The target element to show/hide
Returns:
void