yay!
On Nov 23, 4:00 pm, ricardobeat <[EMAIL PROTECTED]> wrote: > Nice. Haven't looked thorougly at the plugin, but it seems all you > have to do is: > > $('table td:eq(x)').bubble('click'); > > On Nov 23, 6:36 pm, Leeoniya <[EMAIL PROTECTED]> wrote: > > > Ariel, any chance of a sample that uses your listen plugin or the > > delegate plugin that would make use of bubble? the single provided > > example is too complex for mere mortals like myself. my specific case > > i need to do something like: > > > $("#myTable").listen("click", "td, th", function(e){alert(this.id + ' > > ' + $(this).parent('tr').attr('id'));}) > > > now i want to manually trigger the click on "#myTable th:eq(5)"...and > > have it work exactly the same way as it would with a real click, > > retaining the correct "this". > > > thx > > > On Nov 23, 9:58 am, Ariel Flesler <[EMAIL PROTECTED]> wrote: > > > > That's what jQuery.Bubble is for > > > >http://plugins.jquery.com/project/Bubble > > > > Cheers > > > > -- > > > Ariel Fleslerhttp://flesler.blogspot.com > > > > On 22 nov, 23:46, "Jeffrey Kretz" <[EMAIL PROTECTED]> wrote: > > > > > Do you know if this plays friendly with the jQuery event model? > > > > > Looking through the source code, it has its own implementation of "fix" > > > > for > > > > events, along with its own data storage for event handlers. > > > > > Without testing it, I would tend to think these two libraries wouldn't > > > > jam > > > > up and cause a mess. > > > > > You implement a jquery-based solution using a pattern like this: > > > > > jQuery.fn.bubble = function(type) { > > > > > return this.each(function(i){ > > > > > // Build a fake event, and assign the target==this. > > > > var evt = ....; > > > > evt.target = this; > > > > > var el = this; > > > > while (el) { > > > > > // Look for a handler of the supplied type. > > > > var handler = ....; > > > > > if (handler) > > > > { > > > > handler.apply(parent,[evt]); > > > > break; > > > > } > > > > else > > > > el = el.parentNode; > > > > } > > > > > }); > > > > > }; > > > > -----Original Message----- > > > > From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On > > > > > Behalf Of ricardobeat > > > > Sent: Saturday, November 22, 2008 4:44 PM > > > > To: jQuery (English) > > > > Subject: [jQuery] Re: event delegation - great, but how does one > > > > trigger the > > > > handlers through code? > > > > > You're right, it doesn't work. > > > > > Maybe NW Events could help here:http://code.google.com/p/nwevents/ > > > > > It's an event manager and it can fire/propagate 'fake' events. > > > > > - ricardo > > > > > On Nov 22, 7:32 pm, "Jeffrey Kretz" <[EMAIL PROTECTED]> wrote: > > > > > I pretty sure it won't, because click() will fire trigger(), which > > > > > will > > > > use > > > > > data() to lookup the bound event of the selected element, and not find > > > > > anything. > > > > > > Haven't tested this though. > > > > > > JK > > > > > > -----Original Message----- > > > > > From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On > > > > > > Behalf Of ricardobeat > > > > > Sent: Saturday, November 22, 2008 7:43 AM > > > > > To: jQuery (English) > > > > > Subject: [jQuery] Re: event delegation - great, but how does one > > > > > trigger > > > > the > > > > > handlers through code? > > > > > > Can't you just $('tbody td:eq(x)').click() ? The event should > > > > > propagate as normal and reach the tbody. I guess. > > > > > > On Nov 22, 1:11 am, Leeoniya <[EMAIL PROTECTED]> wrote: > > > > > > During event delegation, handlers are registered higher in the DOM > > > > > > tree and then filtered when the event is triggered. This is great if > > > > > > you have 2000 td/th cells, you can attach a listener to tbody and > > > > > > filter down. But would i trigger the event programatically? Since > > > > > > the > > > > > > handler isnt actually registered on the td cells, i cant figure out > > > > > > a > > > > > > way to do this except maybe construct a fake event with the source > > > > > > element by hand and pass it into the handler somehow?? > > > > > > > this is the biggest drawback to delegation that i have run into, it > > > > > > would be great to find a good way to manually trigger these events - > > > > > > if anyone has some advice, please share. > > > > > > > thanks, > > > > > > Leon