Code coverage report for src\event.js

Statements: 78.57% (33 / 42)      Branches: 53.85% (14 / 26)      Functions: 100% (9 / 9)      Lines: 78.57% (33 / 42)      Ignored: none     

All files » src/ » event.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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 991     1 1   1 6         6             6                   6   6     1   3 10           10 1     9   9 9 3             6 6           1 1     1   1           1     1 1     1 1     1 1     1 1          
var oldLoad = jQuery.fn.load,
	originalFix = jQuery.event.fix;
 
jQuery.event.props = [];
jQuery.event.fixHooks = {};
 
jQuery.event.fix = function( originalEvent ) {
	var event,
		type = originalEvent.type,
		fixHook = this.fixHooks[ type ],
		props = jQuery.event.props;
 
	Iif ( props.length ) {
		migrateWarn( "jQuery.event.props are deprecated and removed: " + props.join() );
		while ( props.length ) {
			jQuery.event.addProp( props.pop() );
		}
	}
 
	Iif ( fixHook && !fixHook._migrated_ ) {
		fixHook._migrated_ = true;
		migrateWarn( "jQuery.event.fixHooks are deprecated and removed: " + type );
		if ( ( props = fixHook.props ) && props.length ) {
			while ( props.length ) {
			   jQuery.event.addProp( props.pop() );
			}
		}
	}
 
	event = originalFix.call( this, originalEvent );
 
	return fixHook && fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
};
 
jQuery.each( [ "load", "unload", "error" ], function( _, name ) {
 
	jQuery.fn[ name ] = function() {
		var args = Array.prototype.slice.call( arguments, 0 );
 
		// If this is an ajax load() the first arg should be the string URL;
		// technically this could also be the "Anything" arg of the event .load()
		// which just goes to show why this dumb signature has been deprecated!
		// jQuery custom builds that exclude the Ajax module justifiably die here.
		if ( name === "load" && typeof args[ 0 ] === "string" ) {
			return oldLoad.apply( this, args );
		}
 
		migrateWarn( "jQuery.fn." + name + "() is deprecated" );
 
		args.splice( 0, 0, name );
		if ( arguments.length ) {
			return this.on.apply( this, args );
		}
 
		// Use .triggerHandler here because:
		// - load and unload events don't need to bubble, only applied to window or image
		// - error event should not bubble to window, although it does pre-1.7
		// See http://bugs.jquery.com/ticket/11820
		this.triggerHandler.apply( this, args );
		return this;
	};
 
} );
 
// Trigger "ready" event only once, on document ready
jQuery( function() {
	jQuery( document ).triggerHandler( "ready" );
} );
 
jQuery.event.special.ready = {
	setup: function() {
		Iif ( this === document ) {
			migrateWarn( "'ready' event is deprecated" );
		}
	}
};
 
jQuery.fn.extend( {
 
	bind: function( types, data, fn ) {
		migrateWarn( "jQuery.fn.bind() is deprecated" );
		return this.on( types, null, data, fn );
	},
	unbind: function( types, fn ) {
		migrateWarn( "jQuery.fn.unbind() is deprecated" );
		return this.off( types, null, fn );
	},
	delegate: function( selector, types, data, fn ) {
		migrateWarn( "jQuery.fn.delegate() is deprecated" );
		return this.on( types, selector, data, fn );
	},
	undelegate: function( selector, types, fn ) {
		migrateWarn( "jQuery.fn.undelegate() is deprecated" );
		return arguments.length === 1 ?
			this.off( selector, "**" ) :
			this.off( types, selector || "**", fn );
	}
} );