add code comments
[civicrm-core.git] / js / crm.drupal.js
index fc0411aed2a3b2e496e8278a1f7cbcd2c7604cb0..32ed437423d3933cb60c5b2753285bfd55a80931 100644 (file)
@@ -6,7 +6,10 @@ CRM.$(function($) {
       Drupal.attachBehaviors(e.target);
     })
     .on('crmUnload', function(e) {
-      Drupal.detachBehaviors(e.target);
+      // This function doesn't exist in D6 so call conditionally
+      if (typeof Drupal.detachBehaviors === 'function') {
+        Drupal.detachBehaviors(e.target);
+      }
     })
     .on('dialogopen', function(e) {
       // D7 hack to get the toolbar out of the way (CRM-15341)
@@ -17,5 +20,5 @@ CRM.$(function($) {
         // D7 hack, restore toolbar position (CRM-15341)
         $('#toolbar').css('z-index', '');
       }
-    })
+    });
 });