Skip to content

Instantly share code, notes, and snippets.

@pifantastic
Created January 18, 2012 04:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pifantastic/1630919 to your computer and use it in GitHub Desktop.
Save pifantastic/1630919 to your computer and use it in GitHub Desktop.
{
removeClass: function (name) {
for (var i = 0; i < this.length; i++) {
if (name === undefined) { this[i].className = ''; return this; }
var classList = this[i].className;
name.split(/\s+/g).forEach(function (cname) {
classList = classList.replace(classRE(cname), "");
});
if (classList.length > 0)
this[i].className = classList.trim();
else
classList = "";
}
return this;
}
}
{
removeClass: function(name){
return this.each(function(idx) {
if(name === undefined)
return this.className = '';
classList = this.className;
funcArg(this, name, idx, classList).split(/\s+/g).forEach(function(klass) {
classList = classList.replace(classRE(klass), " ")
});
this.className = classList.trim()
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment