Sign into your Cozi account: Sign In

« Combining JavaScript and CSS files for Improved Performance | Main | A Way To Unit Test ASP.NET IHttpHandler Implementations »

April 23, 2008



This was a very insightful post and I've been having similar problems and, just like you, couldn't find much about it on the web besides this post.


Stelian Dumitrascu

Thank you, Joanna, for a very useful article.


Thanks! This was awesome. It needs an update for jQuery 1.4.3. In 1.4.3, you can return false in a bind handler to stop event propagation.

The fix is put a "return" in front of the line that starts with origFn.apply(...

Consider this example:

var b1 = $("b1").appendTo($("body")).click(function(evt){console.debug("b1 click", evt); $(document).one("click", function(evt){console.debug("document click", evt)}); return false;});

In this example, we add a button to the page. In the button's click, we register a click event on the document and return false. The native jQuery behavior is that only the buttons click will trigger on the first click. If you don't patch your jQuery.fn.bind override, both the button's and the document's click will trigger.

Jamey Taylor

...Another bug:

The block:
var wrappedFn = function() { ... };

should be changed to

var wrappedFn = jQuery.proxy(origFn, function () { ... });

The symptom I ran into that needed this fix is that draggable jQuery UI dialogs wouldn't stop dragging once started.

Account Deleted

Good Post.. Interestingly, I tried your 'example page' in my browser( Mozilla 3.6.16) all the three alert boxes are shown. I use jQuery 1.4.4. Has this bug been resolved in this version of jQuery?

Niklas B

Jamey-taylor, can you pose a code example with your fix?

The comments to this entry are closed.


Cozi Tech Blog RSS Feed Cozi RSS XML Feed

Other Cozi Blogs

  • Cozi Connection Blog
    Visit the Cozi Connection Blog for the latest information about Cozi (the company) and tips about Cozi (the software).
  • flow|state
    The user interface blog by Cozi co-founder Jan Miksovsky.