File util/util.js


file util/util.js

Object Summary
Browser sniffing as implemented in jQuery.
Universal DOM Ready implementation adapted from Tanny O'Haley: http://tanny.ica.com/ICA/TKO/tkoblog.nsf/dx/domcontentloaded-for-browsers-part-v NOTE: this object is largely undocumented in the API.

Function Summary
public static boolean hasClass (DOMElement node, String cl)
Tests to see whether a dOM element has a given class name.
public static void onDOMReady (Function fn)
Executes a function (which itself could call many functions, i.e.) once the DOM is ready to be manipulated.
public static DOMElement select (String selector, [DOMELement context])
Select a DOM Element. This is largely adapted from jQuery's $ function. Main differences: no select(html) handling and select(".class") adapted from Dustin Diaz

Function Details

function hasClass

public static boolean hasClass(DOMElement node, String cl)
Tests to see whether a dOM element has a given class name. Used internally by select, but also useful on its own.
Parameters:
node - the DOM node to check whether or not has class
cl - the class name for which to test
Returns:
true iff node has class cl, false otherwise (null if node not an element)

function onDOMReady

public static void onDOMReady(Function fn)
Executes a function (which itself could call many functions, i.e.) once the DOM is ready to be manipulated. Very useful to wrap around functions that will manipulate the DOM
Parameters:
fn - the function to be executed when the DOM is ready

function select

public static DOMElement select(String selector, [DOMELement context])
Select a DOM Element. This is largely adapted from jQuery's $ function. Main differences: no select(html) handling and select(".class") adapted from Dustin Diaz
Parameters:
selector - the selection criterion; either a DOM node, or a string of form: "#id" or ".class"
[context] - for ".class" searches, the parent node below which to look
Returns:
a DOM Node: either the one with the ID specified, or an array of elements with the same class name; null if none