Nodejs HTML Element Class Remove removeClass(className)

Here you can find the source of removeClass(className)

Method Source Code

Element.prototype.removeClass = function(className){
   this.className = this.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)'), '$1');
   return this;//from  ww  w .  j av a  2  s  .  c  o m
}

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(cls)
    Element.prototype.removeClass = function(cls) {
      if (this.hasClass(cls)) {
          var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
        this.className=this.className.replace(reg,' ');
    };
    
  4. removeStyleClass(className)
    Element.prototype.removeStyleClass = function(className) {
        if (this.className === className) {
            this.className = "";
            return;
        var regex = new RegExp("(^|\\s+)" + className.escapeForRegExp() + "($|\\s+)");
        if (regex.test(this.className))
            this.className = this.className.replace(regex, " ");
    };
    ...