javascript/selenium-core/scripts/htmlutils.js
function clone(orig) {
    var copy;
    switch(typeof(orig)) {
        case 'object':
            copy = (orig.length) ? [] : {};
            for (var attr in orig) {
                copy[attr] = clone(orig[attr]);
            }
            break;
        default:
            copy = orig;
            break;
    }
    return copy;
}
function clone(orig) {
    var copy;
    switch(typeof(orig)) {
        case 'object':
            copy = (orig.length) ? [] : {};
            for (var attr in orig) {
                copy[attr] = clone(orig[attr]);
            }
            break;
        default:
            copy = orig;
            break;
    }
    return copy;
}
function clone ( orig ) { var copy ; switch ( typeof ( orig ) ) { case 'object' : copy = ( orig . length ) ? [ ] : { } ; for ( var attr in orig ) { copy [ attr ] = clone ( orig [ attr ] ) ; } break ; default : copy = orig ; break ; } return copy ; }
Create a clone of an object and return it. This is a deep copy of everything
but functions, whose references are copied. You shouldn't expect a deep copy
of functions anyway.

@param orig  the original object to copy
@return      a deep copy of the original object. Any functions attached,
however, will have their references copied only.
Create a clone of an object and return it . This is a deep copy of everything but functions whose references are copied . You shouldn t expect a deep copy of functions anyway .