tinymce.full.js
function (elm, name, value) {
        var self = this, originalValue, hook, settings = self.settings;

        if (value === '') {
          value = null;
        }

        elm = self.$$(elm);
        originalValue = elm.attr(name);

        if (!elm.length) {
          return;
        }

        hook = self.attrHooks[name];
        if (hook && hook.set) {
          hook.set(elm, value, name);
        } else {
          elm.attr(name, value);
        }

        if (originalValue != value && settings.onSetAttrib) {
          settings.onSetAttrib({
            attrElm: elm,
            attrName: name,
            attrValue: value
          });
        }
      }
function (elm, name, value) {
        var self = this, originalValue, hook, settings = self.settings;

        if (value === '') {
          value = null;
        }

        elm = self.$$(elm);
        originalValue = elm.attr(name);

        if (!elm.length) {
          return;
        }

        hook = self.attrHooks[name];
        if (hook && hook.set) {
          hook.set(elm, value, name);
        } else {
          elm.attr(name, value);
        }

        if (originalValue != value && settings.onSetAttrib) {
          settings.onSetAttrib({
            attrElm: elm,
            attrName: name,
            attrValue: value
          });
        }
      }
function ( elm , name , value ) { var self = this , originalValue , hook , settings = self . settings ; if ( value === '' ) { value = null ; } elm = self . $$ ( elm ) ; originalValue = elm . attr ( name ) ; if ( ! elm . length ) { return ; } hook = self . attrHooks [ name ] ; if ( hook && hook . set ) { hook . set ( elm , value , name ) ; } else { elm . attr ( name , value ) ; } if ( originalValue != value && settings . onSetAttrib ) { settings . onSetAttrib ( { attrElm : elm , attrName : name , attrValue : value } ) ; } }
Sets the specified attribute of an element or elements.

@method setAttrib
@param {Element/String/Array} elm DOM element, element id string or array of elements/ids to set attribute on.
@param {String} name Name of attribute to set.
@param {String} value Value to set on the attribute - if this value is falsy like null, 0 or '' it will remove
the attribute instead.
@example
// Sets class attribute on all paragraphs in the active editor
tinymce.activeEditor.dom.setAttrib(tinymce.activeEditor.dom.select('p'), 'class', 'myclass');

// Sets class attribute on a specific element in the current page
tinymce.dom.setAttrib('mydiv', 'class', 'myclass');
Sets the specified attribute of an element or elements .