function removeAttributeValues(element, attributeName, values, keepEmptyAttribute) {
    var attributeVal = element.getAttribute(attributeName);
    if (attributeVal) {
      var
        expStart = '((^| )',
        expEnd = '(?= |$))';

      attributeVal = attributeVal.replace(new RegExp(Array.isArray(values) ?
        expStart + values.join(expEnd + '|' + expStart) + expEnd :
        expStart + values + expEnd, 'g'),
        '');

      if (keepEmptyAttribute || attributeVal) {
        element.setAttribute(attributeName, attributeVal);
      } else {
        element.removeAttribute(attributeName);
      }
    }
  }
/**
   * Remove one or more values from an attribute.
   *
   * removeAttributeValues(element, attributeName, values, keepEmptyAttribute)
   *
   * @param element DOM-element
   * @param attributeName string
   * @param values mixed; string or array of strings
   * @param keepEmptyAttribute bool
   */
Remove one or more values from an attribute.

@param element DOM-element
@param attributeName string
@param values mixed; string or array of strings
@param keepEmptyAttribute bool
Remove one or more values from an attribute . @param element DOM - element @param attributeName string @param values mixed ; string or array of strings @param keepEmptyAttribute bool
function removeAttributeValues(element, attributeName, values, keepEmptyAttribute) {
    var attributeVal = element.getAttribute(attributeName);
    if (attributeVal) {
      var
        expStart = '((^| )',
        expEnd = '(?= |$))';
      attributeVal = attributeVal.replace(new RegExp(Array.isArray(values) ?
        expStart + values.join(expEnd + '|' + expStart) + expEnd :
        expStart + values + expEnd, 'g'),
        '');
      if (keepEmptyAttribute || attributeVal) {
        element.setAttribute(attributeName, attributeVal);
      } else {
        element.removeAttribute(attributeName);
      }
    }
  }
function removeAttributeValues ( element , attributeName , values , keepEmptyAttribute ) { var attributeVal = element . getAttribute ( attributeName ) ; if ( attributeVal ) { var expStart = '((^| )' , expEnd = '(?= |$))' ; attributeVal = attributeVal . replace ( new RegExp ( Array . isArray ( values ) ? expStart + values . join ( expEnd + '|' + expStart ) + expEnd : expStart + values + expEnd , 'g' ) , '' ) ; if ( keepEmptyAttribute || attributeVal ) { element . setAttribute ( attributeName , attributeVal ) ; } else { element . removeAttribute ( attributeName ) ; } } }
Remove one or more values from an attribute.
Remove one or more values from an attribute .