lib/Ext/dom/Element.style.js
function(oldName, newName, prefix, suffix) {
        if (!oldName && !newName) {
            return this;
        }

        oldName = oldName || [];
        newName = newName || [];

        if (!this.isSynchronized) {
            this.synchronize();
        }

        if (!suffix) {
            suffix = '';
        }

        var dom = this.dom,
            map = this.hasClassMap,
            classList = this.classList,
            SEPARATOR = this.SEPARATOR,
            i, ln, name;

        prefix = prefix ? prefix + SEPARATOR : '';
        suffix = suffix ? SEPARATOR + suffix : '';

        if (typeof oldName == 'string') {
            oldName = oldName.split(this.spacesRe);
        }
        if (typeof newName == 'string') {
            newName = newName.split(this.spacesRe);
        }

        for (i = 0, ln = oldName.length; i < ln; i++) {
            name = prefix + oldName[i] + suffix;

            if (map[name]) {
                delete map[name];
                Ext.Array.remove(classList, name);
            }
        }

        for (i = 0, ln = newName.length; i < ln; i++) {
            name = prefix + newName[i] + suffix;

            if (!map[name]) {
                map[name] = true;
                classList.push(name);
            }
        }

        dom.className = classList.join(' ');

        return this;
    }
function(oldName, newName, prefix, suffix) {
        if (!oldName && !newName) {
            return this;
        }

        oldName = oldName || [];
        newName = newName || [];

        if (!this.isSynchronized) {
            this.synchronize();
        }

        if (!suffix) {
            suffix = '';
        }

        var dom = this.dom,
            map = this.hasClassMap,
            classList = this.classList,
            SEPARATOR = this.SEPARATOR,
            i, ln, name;

        prefix = prefix ? prefix + SEPARATOR : '';
        suffix = suffix ? SEPARATOR + suffix : '';

        if (typeof oldName == 'string') {
            oldName = oldName.split(this.spacesRe);
        }
        if (typeof newName == 'string') {
            newName = newName.split(this.spacesRe);
        }

        for (i = 0, ln = oldName.length; i < ln; i++) {
            name = prefix + oldName[i] + suffix;

            if (map[name]) {
                delete map[name];
                Ext.Array.remove(classList, name);
            }
        }

        for (i = 0, ln = newName.length; i < ln; i++) {
            name = prefix + newName[i] + suffix;

            if (!map[name]) {
                map[name] = true;
                classList.push(name);
            }
        }

        dom.className = classList.join(' ');

        return this;
    }
Replaces a CSS class on the element with another.
If the old name does not exist, the new name will simply be added.
@param {String} oldName The CSS class to replace.
@param {String} newName The replacement CSS class.
@param {String} [prefix=''] Prefix to prepend to each class to be replaced.
@param {String} [suffix=''] Suffix to append to each class to be replaced.
@return {Ext.dom.Element} this