Use event delegation, will give you better performance: $(document).mouseup(function(e){ if (conditionsMet) $(e.target).trigger('customevent', [customdata]); });
If you want to stick with binding all elements, try: $("*").mouseup(function(e) { if (conditionsMet) $(this).trigger('customevent', [customData]); e.stopPropagation(); }); - ricardo On Jan 25, 6:15 pm, Michael Bleigh <mble...@gmail.com> wrote: > I am trying to define a custom event that may or may not fire after a > given mouseup event. I want it to be bindable to any element but now > this is causing problems with jQuery 1.3 custom event propagation. My > current implementation is something like this: > > jQuery(function() { > jQuery("*").mouseup(function() { > if (conditionsMet) > jQuery(this).trigger('customevent', [customData]); > }); > > }); > > This works more or less as expected in 1.2.X, but in 1.3 it ends up > triggering multiple times per click because if it triggers on a child, > it is both propagating up to the parent and triggering independently > on the parent (because of the '*' selector). > > How can I write this in a way that it can bind to any element but > prevent triggering for all parent elements during a single event with > the exception of propagation? > > Thanks for any help, > Michael Bleigh