Code coverage report for src\attributes.js

Statements: 100% (18 / 18)      Branches: 94.74% (18 / 19)      Functions: 100% (4 / 4)      Lines: 100% (18 / 18)      Ignored: none     

All files » src/ » attributes.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49  1       1 5   5 6 4 4       5     1     10 2     8     8 8   8 3             8 8                
 
var oldRemoveAttr = jQuery.fn.removeAttr,
	oldToggleClass = jQuery.fn.toggleClass,
	rmatchNonSpace = /\S+/g;
 
jQuery.fn.removeAttr = function( name ) {
	var self = this;
 
	jQuery.each( name.match( rmatchNonSpace ), function( i, attr ) {
		if ( jQuery.expr.match.bool.test( attr ) ) {
			migrateWarn( "jQuery.fn.removeAttr no longer sets boolean properties: " + attr );
			self.prop( attr, false );
		}
	} );
 
	return oldRemoveAttr.apply( this, arguments );
};
 
jQuery.fn.toggleClass = function( state ) {
 
	// Only deprecating no-args or single boolean arg
	if ( state !== undefined && typeof state !== "boolean" ) {
		return oldToggleClass.apply( this, arguments );
	}
 
	migrateWarn( "jQuery.fn.toggleClass( boolean ) is deprecated" );
 
	// Toggle entire class name of each element
	return this.each( function() {
		var className = this.getAttribute && this.getAttribute( "class" ) || "";
 
		if ( className ) {
			jQuery.data( this, "__className__", className );
		}
 
		// If the element has a class name or if we're passed `false`,
		// then remove the whole classname (if there was one, the above saved it).
		// Otherwise bring back whatever was previously saved (if anything),
		// falling back to the empty string if nothing was stored.
		Eif ( this.setAttribute ) {
			this.setAttribute( "class",
				className || state === false ?
				"" :
				jQuery.data( this, "__className__" ) || ""
			);
		}
	} );
};