Applies CSS classes, where'classInfo' keys are added as class names if values are truthy.
Only applies to 'class' attribute.

@param { object } classInfo
@returns { (part: AttributePart) => void }
329378
function classMapDirective(classInfo) {
  return function(part) {
    if (!isAttributePart(part) || part.name !== 'class') {
      throw Error('The `classMap` directive can only be used in the `class` attribute');
    }

    let value = '';

    for (const key in classInfo) {
      if (classInfo[key]) {
        value += `${value.length ? ' ' : ''}${key}`;
      }
    }

    part.setValue(value);
  };
}
1366854
protected function updateClassAttribute()
    {
        $this->classesString = implode(' ', $this->classes);

        $this->element->setAttribute('class', $this->classesString);
    }
414823
function addClass( element ) {
  const addClassNamesArray = _sliceArgs( arguments );
  if ( hasClassList ) {
    element.classList.add.apply( element.classList, addClassNamesArray );
  } else {
    var classes = element.className.split( ' ' );
    addClassNamesArray.forEach( function( name ) {
      if ( classes.indexOf( name ) === -1 ) {
        classes.push( name );
      }
    } );
    element.className = classes.join( ' ' );
  }

  return element;
}
142699
function () {
        if (this._btnElement.checked) {
            u.addClass(this.element, this._CssClasses.IS_CHECKED);
        } else {
            u.removeClass(this.element, this._CssClasses.IS_CHECKED);
        }
    }
737331
function(class_data) {

		var class_path = class_data.path,
			namespace_path,
			class_name,
			namespace;

		if ((class_path in this._sources) || (class_path in this.constructors)) Lava.t("Class is already defined: " + class_path);
		this._sources[class_path] = class_data;

		if (class_data.constructor) {

			namespace_path = class_path.split('.');
			class_name = namespace_path.pop();
			namespace = this._getNamespace(namespace_path);

			if ((class_name in namespace) && namespace[class_name] != null) Lava.t("Class name conflict: '" + class_path + "' property is already defined in namespace path");

			this.constructors[class_path] = class_data.constructor;
			namespace[class_name] = class_data.constructor;

		}

	}
609996
function hasClass(className) {
  var i, val;
  for(i = 0;i < this.length;i++) {
    val = this.get(i).getAttribute(attr);
    val = val ? val.split(/\s+/) : [];
    if(~val.indexOf(className)) {
      return true;
    }
  }
  return false;
}
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;
  }
1364677
def add_css_class(css_classes, css_class, prepend=False):
    
    classes_list = split_css_classes(css_classes)
    classes_to_add = [c for c in split_css_classes(css_class) if c not in classes_list]
    if prepend:
        classes_list = classes_to_add + classes_list
    else:
        classes_list += classes_to_add
    return " ".join(classes_list)
373793
boolean addRelatedClass(final RelType relType, final ClassInfo classInfo) {
        Set<ClassInfo> classInfoSet = relatedClasses.get(relType);
        if (classInfoSet == null) {
            relatedClasses.put(relType, classInfoSet = new LinkedHashSet<>(4));
        }
        return classInfoSet.add(classInfo);
    }
800839
function removeClass(className) {
  if(!className) {
    // remove all classes from all matched elements
    this.each(function(el) {
      el.removeAttribute(attr);
    });
    return this;
  }
  var classes = className.split(/\s+/);
  this.each(function(el) {
    var val = el.getAttribute(attr);
    // no class attribute - nothing to remove
    if(!val) {
      return;
    }
    var names = val.split(/\s+/);
    names = names.filter(function(nm) {
      return ~classes.indexOf(nm) ? false : nm;
    });
    el.setAttribute(attr, names.join(' '));
  });
  return this;
}
519493
function(element, className) {
    invariant(
      !/\s/.test(className),
      'CSS.hasClass takes only a single class name.'
    );
    if (element.classList) {
      return !!className && element.classList.contains(className);
    }
    return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1;
  }
156214
function (elements) {
            var elements = elements || [];
            for (var i = 0; i < elements.length; i++) {
                if (elements[i].classList.contains(this.stylings.error)) {
                    elements[i].classList.remove(this.stylings.error);
                    var parent = elements[i].parentNode;
                    parent.removeAttribute("data-hint");
                }
            }
        }
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;
}
1123150
function stringifyClass(classAttr) {
  if (typeof classAttr === 'string') {
    return classAttr;
  }
  var classes = [];
  for (var key in classAttr) {
    if (classAttr[key]) {
      classes.push(key);
    }
  }
  return classes.join(' ');
}
59587
function (iconInfo) {
            var cfg = this._cfg;
            var cssClasses = ariaCoreTplClassLoader.addPrintOptions(this._cssClassNames, cfg.printOptions);
            if (iconInfo.cssClass) {
                cssClasses += " " + iconInfo.cssClass;
            }
            if (cfg.block) {
                cssClasses += " xBlock";
            }
            return cssClasses;
        }
214534
function removeClass(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;

      let regex = new RegExp('^' + c + '\\s+|\\s+' + c + '|^' + c + '$', 'g');
      e.className = e.className.replace(regex, '');
    }

    if (e.className === '') {
      e.removeAttribute('class');
    }
  }
}
114377
function sortCssClasses(attrs) {
    /**
     * Sorts the given CSS class attribute
     * @param {String} cssClasses
     * @returns {String}
     */
    function _sortCssClassesValues(cssClasses) {
        var classList = (cssClasses || '').split(' ');

        return _(classList)
            .filter()
            .uniq()
            .sort()
            .join(' ');
    }

    var classIndexes = _getIndexesInArray(attrs, 'class');

    _.forEach(classIndexes, function (index) {
        attrs[index].value = _sortCssClassesValues(attrs[index].value);
    });

    return attrs;
}