Commits

Stephen McDonald committed 932e92d Merge

Merge

Comments (0)

Files changed (1)

filebrowser_safe/static/filebrowser/js/AddFileBrowser.js

     }
 }
 
-function addEvent( obj, type, fn ) {
-    if ( obj.attachEvent ) {
-        obj['e'+type+fn] = fn;
-        obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
-        obj.attachEvent( 'on'+type, obj[type+fn] );
-    } else
-        obj.addEventListener( type, fn, false );
+if (!addEvent){
+    function addEvent(obj, evType, fn) {
+        if (obj.addEventListener) {
+            obj.addEventListener(evType, fn, false);
+            return true;
+        } else if (obj.attachEvent) {
+            var r = obj.attachEvent("on" + evType, fn);
+            return r;
+        } else {
+            return false;
+        }
+    }
 }
 
 addEvent(window, 'load', FileBrowser.init);