-jQuery.each({
- removeAttr: function( name ) {
- jQuery.attr( this, name, "" );
- if (this.nodeType == 1) {
- this.removeAttribute( name );
- }
- },
-
- toggleClass: function( classNames, state ) {
- var type = typeof classNames;
- if ( type === "string" ) {
- // toggle individual class names
- var isBool = typeof state === "boolean", className, i = 0,
- classNames = classNames.split( /\s+/ );
- while ( (className = classNames[ i++ ]) ) {
- // check each className given, space seperated list
- state = isBool ? state : !jQuery(this).hasClass( className );
- jQuery(this)[ state ? "addClass" : "removeClass" ]( className );
- }
- } else if ( type === "undefined" || type === "boolean" ) {
- if ( this.className ) {
- // store className if set
- jQuery.data( this, "__className__", this.className );
- }
- // toggle whole className
- this.className = this.className || classNames === false ? "" : jQuery.data( this, "__className__" ) || "";
- }
- }
-}, function(name, fn){
- jQuery.fn[ name ] = function(){
- return this.each( fn, arguments );
- };
-});
-