Bubble
This plugin adds bubbling functionality to jQuery. The code is similar to jQuery.fn.trigger's because it's meant to extend it. It also generates it's own event object, that will remain untouched through the bubbling, meaning it's safe to attach attributes to it and grab them with the ancestors while the event bubbles up.
I tried to use jQuery's core functions as much as possible, but most functions I needed were not compatible, and would destroy the custom event object, still the code remains short.
NOTES:
- jQuery.Bubble 1.0 was tested with jQuery 1.3.1 and it's compatible with it's event system.
- jQuery.Bubble 1.2 and further versions will stick to the new system(1.2 's).
- There're two versions, the regular (async) and the synchronic version. I'm not sure which one works better, I suppose the asynchronic one resembles more to the browser's native (bubbling) behavior, so I'd use that one. Please let me know if you test them.
评论