Adds the class passed in to the element if it doesn't already have it.

@param {DOMElement} element the element to set the class on
@param {string} className the CSS className
@return {DOMElement} the element passed in
978743
function(element, className) {
    invariant(
      !/\s/.test(className),
      'CSSCore.addClass takes only a single class name. "%s" contains ' +
      'multiple classes.', className
    );

    if (className) {
      if (element.classList) {
        element.classList.add(className);
      } else if (!CSSCore.hasClass(element, className)) {
        element.className = element.className + ' ' + className;
      }
    }
    return element;
  }
109769
public function addElement($element, $name = null) {
		if ($name === null) {
			$this->_elements[] = $element;
		} else {
			$this->_elements[$name] = $element;
		}
		
		return $this;
	}
306307
def _add_to_class(self, name, method):
        
        if hasattr(self._element_cls, name):
            return
        setattr(self._element_cls, name, method)
336364
function hasClass(element, name) {
    var list = typeof element == 'string' ? element : classList(element);
    return list.indexOf(' ' + name + ' ') >= 0;
  }
1141331
function(element, classToRemove) {
        if (!hasClass(element, classToRemove)) {
            return;
        }

        var classNames = element.className.split(' ');

        // no arr.indexOf in ie8, and we don't want to add a big shim
        for (var i = classNames.length - 1; i >= 0; i--) {
            if (classNames[i] === classToRemove) {
                classNames.splice(i, 1);
            }
        }
        element.className = classNames.join(' ');
        return this;
    }
1320134
function (className,config)
		{
			var component = this.createClass(className,config);
			if (component)
				component.setParent(this);
			return component;
		}
1177835
function setClassName(element, cssClass) {
    cssClass = snippet.isArray(cssClass) ? cssClass.join(' ') : cssClass;

    cssClass = trim(cssClass);

    if (snippet.isUndefined(element.className.baseVal)) {
        element.className = cssClass;

        return;
    }

    element.className.baseVal = cssClass;
}
1309338
public Element toggleClass(String className) {
        Validate.notNull(className);

        Set<String> classes = classNames();
        if (classes.contains(className))
            classes.remove(className);
        else
            classes.add(className);
        classNames(classes);

        return this;
    }
708775
function() {
        var comp,
            c = this.__c,
            str = "";
        for (comp in c) {
            str += " " + comp;
        }
        str = str.substr(1);
        this._element.className = str;
    }
666236
function(element, value) {
	if(element){
		if(typeof element.classList === 'undefined') {
			if(u._addClass){
				u._addClass(element, value);
			}else{
				$(element).addClass(value);
			}

		} else {
			element.classList.add(value);
		}
	}

	return this;
}
1309587
function addClasses(element, classNames) {

  var classes = domClasses(element);

  var actualClassNames = isArray(classNames) ? classNames : classNames.split(/\s+/g);
  actualClassNames.forEach(function(cls) {
    classes.add(cls);
  });
}
635864
def add_class(self, className):
        
        if className not in self._dom_classes:
            self._dom_classes = list(self._dom_classes) + [className]
        return self
1117088
function(element, className) {
        var re = new RegExp('(\\s|^)'+className+'(\\s|$)');
        if (re.test(element.className)) return;
        element.className += ' ' + className;
      }
1196058
function(element, attrs) {

            var $element = $(element);

            joint.util.forIn(attrs, function(attrs, selector) {
                var $elements = $element.find(selector).addBack().filter(selector);
                // Make a special case for setting classes.
                // We do not want to overwrite any existing class.
                if (joint.util.has(attrs, 'class')) {
                    $elements.addClass(attrs['class']);
                    attrs = joint.util.omit(attrs, 'class');
                }
                $elements.attr(attrs);
            });
        }
903111
public function addClass(DOMElement &$element, $class)
    {
        if (empty($class)) {
            return $element;
        }

        // Normalize class
        $class = trim($class);
        if (empty($class)) {
            return $element;
        }

        // Get current class
        $currentClass = trim($this->attr($element, 'class'));

        // Check if class already exists
        $classes = explode(' ', $currentClass);
        if (in_array($class, $classes)) {
            return $element;
        }

        // Append new class
        $this->appendAttr($element, 'class', $class);

        // Return the DOM Element
        return $element;
    }
1008964
function _addClass(element, className, classRegExp) {
    if (element.className) {
      _removeClass(element, classRegExp);
      element.className = wysihtml5.lang.string(element.className + " " + className).trim();
    } else {
      element.className = className;
    }
  }
916444
function addClass(element, className) {
  let elements = [].concat(element);
  let classes = [];
  let n = elements.length;

  if (!assert((typeof className === 'string') || (className instanceof Array), 'Invalid class name specified. Must be either a string or an array of strings.')) return;

  if (typeof className === 'string')
    classes.push(className);
  else
    classes = className;

  let nClasses = classes.length;

  for (let i = 0; i < n; i++) {
    let e = elements[i];

    for (let j = 0; j < nClasses; j++) {
      let c = classes[j];

      if (!assert(typeof c === 'string', 'Invalid class detected: ' + c)) continue;
      if (hasClass(e, c)) continue;

      e.className = e.className + ((e.className === '') ? '' : ' ') + c;
    }
  }
}