eldarion/bootstrap-ajax — pull request #42 by petermelias (2013-06-11 22:08:06+00:00)
Title: Fix for PR #35 - Triggers success event on parent of replaced element

There were a few solutions to this issue. I felt the most idiomatic one was to simply trigger the event on the parent of the replaced element rather than a document wide trigger.

The problem here is that normal event bubbling won't work because the replaced element destroys the initial event trigger. In order to make it work, you would either have to have a dedicated element specified as an "event proxy" of sorts, or trigger the event document-wide.

Since the document-wide approach felt a bit overboard, and the dedicated element seemed like clutter, I opted to use the parent element since in most of my use cases that element remains untouched and is readily available for subscription by the consuming code.

I also added some semi-colons :)