> The event object gets cloned so all the properties get preserved in the
> bubble. There could be some mileage in passing the original object along
> for performance reasons though.
No, actually it's the same object all along. This is ok then.
> Bubbling non-native events in the main use case for the patch. I think that
> trigger should bubble events just like when events are triggered from the
> browser.
Not all native events bubble. Mouse and keyboard events bubble because
when you click an element (f.e) you're actually clicking its parents
too.
On the contrary, when an input gets the focus or an image loads, it
doesn't mean its ancestor did too.
I think custom events fall on the second category. Imagine something
like this:
$('#some_form').trigger('postNow')
$('#slideshow').trigger('next') // used on serialScroll
$('#foo').trigger('setDatafx') // used by jQuery.data / fx module
$('#bar').trigger('ajaxComplete') // ajax module
You wouldn't expect those events to bubble because they are referred
to that solely element.
While in some cases it CAN be useful:
- f.e Bind custom events to a table and trigger them on tr's.
I think they're the minority and can be replaced by global triggering
or binding to a global element (document|html|body). That's what I do
instead of $.trigger.
Cheers
--
Ariel Flesler
http://flesler.blogspot.com/