Code: Go native

Chapter 8 - Ajax Optimization

If you employ a library or write your own version of such helpers, make sure you check for a native version of the library first before using your own code, which may be slower.

function getElementsByClassName(class)
{
    if (document.getElementsByClassName( )
    return document.getElementsByClassName(class);
    /* otherwise do my slower version */
}