blocks-dock MDL-23891 Avoided use of broken YUI ancestor function in IE
authorSam Hemelryk <sam@moodle.com>
Mon, 23 Aug 2010 02:55:04 +0000 (02:55 +0000)
committerSam Hemelryk <sam@moodle.com>
Mon, 23 Aug 2010 02:55:04 +0000 (02:55 +0000)
blocks/dock.js

index 641a1e1..6223c88 100644 (file)
@@ -284,14 +284,22 @@ M.core_dock.getPanel = function() {
  */
 M.core_dock.handleEvent = function(e, options) {
     var item = this.getActiveItem();
-    var target = (e.target.test(options.cssselector))?e.target:e.target.ancestor(options.cssselector);
     if (options.cssselector == 'body') {
         if (!this.nodes.dock.contains(e.target)) {
             if (item) {
                 item.hide();
             }
         }
-    } else if (target) {
+    } else {
+        var target;
+        if (e.target.test(options.cssselector)) {
+            target = e.target;
+        } else {
+            target = e.target.ancestor(options.cssselector);
+        }
+        if (!target) {
+            return true;
+        }
         if (this.preventevent !== null && e.type === this.preventevent) {
             return true;
         }