if ( !element ) {
// Only trigger if we've ever bound an event for it
if ( this.global[type] )
- jQuery("*").trigger(type, data);
+ jQuery("*").add([window, document]).trigger(type, data);
// Handle triggering a single element
} else {
args[0].handler = c[j];
args[0].data = c[j].data;
- if ( c[j].apply( this, args ) === false ) {
+ var tmp = c[j].apply( this, args );
+
+ if ( val !== false )
+ val = tmp;
+
+ if ( tmp === false ) {
event.preventDefault();
event.stopPropagation();
- val = false;
}
}
* @see $(Function)
*/
ready: function(f) {
+ // Attach the listeners
+ bindReady();
+
// If the DOM is already ready
if ( jQuery.isReady )
// Execute the function immediately
}
});
-new function(){
-
/**
* Bind a function to the scroll event of each matched element.
*
};
});
-
+
+var readyBound = false;
+
+function bindReady(){
+ if ( readyBound ) return;
+ readyBound = true;
+
// If Mozilla is used
if ( jQuery.browser.mozilla || jQuery.browser.opera )
// Use the handy event callback
// A fallback to window.onload, that will always work
jQuery.event.add( window, "load", jQuery.ready );
-
-};
+}