add: function( proxy, data, namespaces ) {
jQuery.extend( proxy, data || {} );
proxy.guid += data.selector + data.live;
- jQuery.event.add( this, data.live, liveHandler );
+ jQuery.event.add( this, data.live, liveHandler, data );
},
remove: function( namespaces ) {
if ( !e ) {
return;
}
+
// if preventDefault exists run it on the original event
if ( e.preventDefault ) {
e.preventDefault();
};
});
+(function() {
+
+ var event = jQuery.event,
+ special = event.special,
+ handle = event.handle;
+
+ special.submit = {
+ setup: function(data, namespaces) {
+ if(data.selector) {
+ event.add(this, 'click.specialSubmit', function(e, eventData) {
+ if(jQuery(e.target).filter(":submit, :image").closest(data.selector).length) {
+ e.type = "submit";
+ return handle.call( this, e, eventData );
+ }
+ });
+
+ event.add(this, 'keypress.specialSubmit', function( e, eventData ) {
+ if(jQuery(e.target).filter(":text, :password").closest(data.selector).length) {
+ e.type = "submit";
+ return handle.call( this, e, eventData );
+ }
+ });
+ } else {
+ return false;
+ }
+ },
+
+ remove: function(namespaces) {
+ event.remove(this, 'click.specialSubmit');
+ event.remove(this, 'keypress.specialSubmit');
+ }
+ };
+
+})();
+
// Create "bubbling" focus and blur events
jQuery.each({
focus: "focusin",
});
jQuery.fn.extend({
+ // TODO: make bind(), unbind() and one() DRY!
bind: function( type, data, fn, thisObject ) {
- if ( jQuery.isFunction( data ) ) {
- if ( fn !== undefined ) {
- thisObject = fn;
+ // Handle object literals
+ if ( typeof type === "object" ) {
+ for ( var key in type ) {
+ this.bind(key, data, type[key], fn);
}
+ return this;
+ }
+
+ if ( jQuery.isFunction( data ) ) {
+ thisObject = fn;
fn = data;
data = undefined;
}
},
one: function( type, data, fn, thisObject ) {
- if ( jQuery.isFunction( data ) ) {
- if ( fn !== undefined ) {
- thisObject = fn;
+ // Handle object literals
+ if ( typeof type === "object" ) {
+ for ( var key in type ) {
+ this.one(key, data, type[key], fn);
}
+ return this;
+ }
+
+ if ( jQuery.isFunction( data ) ) {
+ thisObject = fn;
fn = data;
data = undefined;
}
},
unbind: function( type, fn ) {
+ // Handle object literals
+ if ( typeof type === "object" && !type.preventDefault ) {
+ for ( var key in type ) {
+ this.unbind(key, type[key]);
+ }
+ return this;
+ }
+
return this.each(function() {
jQuery.event.remove( this, type, fn );
});
// If IE and not an iframe
// continually check to see if the document is ready
- if ( document.documentElement.doScroll && window === window.top ) (function() {
+ // NOTE: DO NOT CHANGE TO ===, FAILS IN IE.
+ if ( document.documentElement.doScroll && window == window.top ) (function() {
if ( jQuery.isReady ) {
return;
}