- // $pane, the event target, is an element whose content is to be
- // replaced. Pseudoclasses on $pane (pane-loading, etc) encode the
- // current loading state.
- var $pane = $(e.target);
-
- var content_url = $pane.attr('data-pane-content-url');
- if (!content_url) {
- // When reloadable elements are nested, we can receive
- // arv:pane:reload events even though the selector in .on()
- // does not match e.target. Ignore such events.
+ if (this != e.target) {
+ // An arv:pane:reload event was sent to an element (e.target)
+ // which happens to have an ancestor (this) matching the above
+ // '[data-pane-content-url]' selector. This happens because
+ // events bubble up the DOM on their way to document. However,
+ // here we only care about events delivered directly to _this_
+ // selected element (i.e., this==e.target), not ones delivered
+ // to its children. The event "e" is uninteresting here.