Fix whitespace in event.js

This commit is contained in:
Colin Snover 2010-12-26 14:28:13 -06:00
parent 52b1709b94
commit a939ade9c6

View file

@ -63,7 +63,7 @@ jQuery.event = {
var eventKey = elem.nodeType ? "events" : "__events__", var eventKey = elem.nodeType ? "events" : "__events__",
events = elemData[ eventKey ], events = elemData[ eventKey ],
eventHandle = elemData.handle; eventHandle = elemData.handle;
if ( typeof events === "function" ) { if ( typeof events === "function" ) {
// On plain objects events is a fn that holds the the data // On plain objects events is a fn that holds the the data
// which prevents this data from being JSON serialized // which prevents this data from being JSON serialized
@ -143,9 +143,9 @@ jQuery.event = {
} }
} }
} }
if ( special.add ) { if ( special.add ) {
special.add.call( elem, handleObj ); special.add.call( elem, handleObj );
if ( !handleObj.handler.guid ) { if ( !handleObj.handler.guid ) {
handleObj.handler.guid = handler.guid; handleObj.handler.guid = handler.guid;
@ -184,7 +184,7 @@ jQuery.event = {
if ( !elemData || !events ) { if ( !elemData || !events ) {
return; return;
} }
if ( typeof events === "function" ) { if ( typeof events === "function" ) {
elemData = events; elemData = events;
events = events.events; events = events.events;
@ -222,7 +222,7 @@ jQuery.event = {
namespaces = type.split("."); namespaces = type.split(".");
type = namespaces.shift(); type = namespaces.shift();
namespace = new RegExp("(^|\\.)" + namespace = new RegExp("(^|\\.)" +
jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)"); jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
} }
@ -384,7 +384,7 @@ jQuery.event = {
isClick = jQuery.nodeName( target, "a" ) && targetType === "click", isClick = jQuery.nodeName( target, "a" ) && targetType === "click",
special = jQuery.event.special[ targetType ] || {}; special = jQuery.event.special[ targetType ] || {};
if ( (!special._default || special._default.call( elem, event ) === false) && if ( (!special._default || special._default.call( elem, event ) === false) &&
!isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) { !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {
try { try {
@ -454,7 +454,7 @@ jQuery.event = {
event.handler = handleObj.handler; event.handler = handleObj.handler;
event.data = handleObj.data; event.data = handleObj.data;
event.handleObj = handleObj; event.handleObj = handleObj;
var ret = handleObj.handler.apply( this, args ); var ret = handleObj.handler.apply( this, args );
if ( ret !== undefined ) { if ( ret !== undefined ) {
@ -553,7 +553,7 @@ jQuery.event = {
add: function( handleObj ) { add: function( handleObj ) {
jQuery.event.add( this, jQuery.event.add( this,
liveConvert( handleObj.origType, handleObj.selector ), liveConvert( handleObj.origType, handleObj.selector ),
jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) ); jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
}, },
remove: function( handleObj ) { remove: function( handleObj ) {
@ -583,7 +583,7 @@ jQuery.removeEvent = document.removeEventListener ?
if ( elem.removeEventListener ) { if ( elem.removeEventListener ) {
elem.removeEventListener( type, handle, false ); elem.removeEventListener( type, handle, false );
} }
} : } :
function( elem, type, handle ) { function( elem, type, handle ) {
if ( elem.detachEvent ) { if ( elem.detachEvent ) {
elem.detachEvent( "on" + type, handle ); elem.detachEvent( "on" + type, handle );
@ -630,7 +630,7 @@ jQuery.Event.prototype = {
if ( !e ) { if ( !e ) {
return; return;
} }
// if preventDefault exists run it on the original event // if preventDefault exists run it on the original event
if ( e.preventDefault ) { if ( e.preventDefault ) {
e.preventDefault(); e.preventDefault();
@ -726,7 +726,7 @@ if ( !jQuery.support.submitBubbles ) {
return trigger( "submit", this, arguments ); return trigger( "submit", this, arguments );
} }
}); });
jQuery.event.add(this, "keypress.specialSubmit", function( e ) { jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
var elem = e.target, var elem = e.target,
type = elem.type; type = elem.type;
@ -788,7 +788,7 @@ if ( !jQuery.support.changeBubbles ) {
if ( e.type !== "focusout" || elem.type !== "radio" ) { if ( e.type !== "focusout" || elem.type !== "radio" ) {
jQuery.data( elem, "_change_data", val ); jQuery.data( elem, "_change_data", val );
} }
if ( data === undefined || val === data ) { if ( data === undefined || val === data ) {
return; return;
} }
@ -802,7 +802,7 @@ if ( !jQuery.support.changeBubbles ) {
jQuery.event.special.change = { jQuery.event.special.change = {
filters: { filters: {
focusout: testChange, focusout: testChange,
beforedeactivate: testChange, beforedeactivate: testChange,
@ -873,15 +873,15 @@ if ( document.addEventListener ) {
if ( focusCounts[fix]++ === 0 ) { if ( focusCounts[fix]++ === 0 ) {
document.addEventListener( orig, handler, true ); document.addEventListener( orig, handler, true );
} }
}, },
teardown: function() { teardown: function() {
if ( --focusCounts[fix] === 0 ) { if ( --focusCounts[fix] === 0 ) {
document.removeEventListener( orig, handler, true ); document.removeEventListener( orig, handler, true );
} }
} }
}; };
function handler( e ) { function handler( e ) {
e = jQuery.event.fix( e ); e = jQuery.event.fix( e );
e.type = fix; e.type = fix;
return jQuery.event.trigger( e, null, e.target ); return jQuery.event.trigger( e, null, e.target );
@ -898,7 +898,7 @@ jQuery.each(["bind", "one"], function( i, name ) {
} }
return this; return this;
} }
if ( jQuery.isFunction( data ) || data === false ) { if ( jQuery.isFunction( data ) || data === false ) {
fn = data; fn = data;
data = undefined; data = undefined;
@ -938,20 +938,20 @@ jQuery.fn.extend({
return this; return this;
}, },
delegate: function( selector, types, data, fn ) { delegate: function( selector, types, data, fn ) {
return this.live( types, data, fn, selector ); return this.live( types, data, fn, selector );
}, },
undelegate: function( selector, types, fn ) { undelegate: function( selector, types, fn ) {
if ( arguments.length === 0 ) { if ( arguments.length === 0 ) {
return this.unbind( "live" ); return this.unbind( "live" );
} else { } else {
return this.die( types, null, fn, selector ); return this.die( types, null, fn, selector );
} }
}, },
trigger: function( type, data ) { trigger: function( type, data ) {
return this.each(function() { return this.each(function() {
jQuery.event.trigger( type, data, this ); jQuery.event.trigger( type, data, this );
@ -1008,12 +1008,12 @@ jQuery.each(["live", "die"], function( i, name ) {
var type, i = 0, match, namespaces, preType, var type, i = 0, match, namespaces, preType,
selector = origSelector || this.selector, selector = origSelector || this.selector,
context = origSelector ? this : jQuery( this.context ); context = origSelector ? this : jQuery( this.context );
if ( typeof types === "object" && !types.preventDefault ) { if ( typeof types === "object" && !types.preventDefault ) {
for ( var key in types ) { for ( var key in types ) {
context[ name ]( key, data, types[key], selector ); context[ name ]( key, data, types[key], selector );
} }
return this; return this;
} }
@ -1060,7 +1060,7 @@ jQuery.each(["live", "die"], function( i, name ) {
context.unbind( "live." + liveConvert( type, selector ), fn ); context.unbind( "live." + liveConvert( type, selector ), fn );
} }
} }
return this; return this;
}; };
}); });
@ -1079,7 +1079,7 @@ function liveHandler( event ) {
if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) { if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) {
return; return;
} }
if ( event.namespace ) { if ( event.namespace ) {
namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)"); namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");
} }