CRM-15346 - pass more specific context to Drupal.behaviors
authorColeman Watts <coleman@civicrm.org>
Tue, 4 Nov 2014 01:32:48 +0000 (20:32 -0500)
committerColeman Watts <coleman@civicrm.org>
Tue, 4 Nov 2014 01:32:48 +0000 (20:32 -0500)
js/crm.drupal.js

index 7699e6e9d9294498c45d587acaeb4e21e7f3ebc3..fc0411aed2a3b2e496e8278a1f7cbcd2c7604cb0 100644 (file)
@@ -1,12 +1,12 @@
 // http://civicrm.org/licensing
 CRM.$(function($) {
   $(document)
-    .on('crmLoad', function() {
+    .on('crmLoad', function(e) {
       // This is drupal's old-school way of listening for 'load' type events. It has to be called manually.
-      Drupal.attachBehaviors(this);
+      Drupal.attachBehaviors(e.target);
     })
-    .on('crmUnload', function() {
-      Drupal.detachBehaviors(this);
+    .on('crmUnload', function(e) {
+      Drupal.detachBehaviors(e.target);
     })
     .on('dialogopen', function(e) {
       // D7 hack to get the toolbar out of the way (CRM-15341)