Nodejs HTML Element Class Remove removeStyleClass(className)

Here you can find the source of removeStyleClass(className)

Method Source Code

Element.prototype.removeStyleClass = function(className) {
    if (this.className === className) {
        this.className = "";
        return;/*  w w w .  j  a  va  2  s. co  m*/
    }

    var regex = new RegExp("(^|\\s+)" + className.escapeForRegExp() + "($|\\s+)");
    if (regex.test(this.className))
        this.className = this.className.replace(regex, " ");
};

Related

  1. removeClass(className)
    Element.prototype.removeClass = function(className) {
      const regex = new RegExp(className, 'g')
      const newClasses = this.className.replace(regex, '')
      this.className = newClasses.trim()
      return this
    
  2. removeClass(className)
    Element.prototype.removeClass=function(className){
      var classNames=this.className.split(' '),
        newClass='';
      for(var i=0;i<classNames.length;i++){
        if(classNames[i]!==className){
          newClass+=' '+classNames[i];
      return !!(this.className=newClass.trim());
    ...
    
  3. removeClass(className)
    Element.prototype.removeClass = function(className){
      this.className = this.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)'), '$1');
      return this;
    
  4. removeClass(cls)
    Element.prototype.removeClass = function(cls) {
      if (this.hasClass(cls)) {
          var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
        this.className=this.className.replace(reg,' ');
    };