Upgrade to ExtJS 3.1.0 - Released 12/16/2009
[extjs.git] / docs / source / ext-base-event.html
index c96becb..7964741 100644 (file)
-<html>
-<head>
-  <title>The source code</title>
-    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
-    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
-</head>
-<body  onload="prettyPrint();">
-    <pre class="prettyprint lang-js">/*!
- * Ext JS Library 3.0.3
- * Copyright(c) 2006-2009 Ext JS, LLC
- * licensing@extjs.com
- * http://www.extjs.com/license
- */
-Ext.lib.Event = function() {\r
-    var loadComplete = false,\r
-        listeners = [],\r
-        unloadListeners = [],\r
-        retryCount = 0,\r
-        onAvailStack = [],\r
-        _interval,\r
-        locked = false,\r
-        win = window,\r
-        doc = document,\r
-        \r
-        // constants            \r
-        POLL_RETRYS = 200,\r
-        POLL_INTERVAL = 20,\r
-        EL = 0,\r
-        TYPE = 1,\r
-        FN = 2,\r
-        WFN = 3,\r
-        OBJ = 3,\r
-        ADJ_SCOPE = 4,   \r
-        SCROLLLEFT = 'scrollLeft',\r
-        SCROLLTOP = 'scrollTop',\r
-        UNLOAD = 'unload',\r
-        MOUSEOVER = 'mouseover',\r
-        MOUSEOUT = 'mouseout',\r
-        // private\r
-        doAdd = function() {\r
-            var ret;\r
-            if (win.addEventListener) {\r
-                ret = function(el, eventName, fn, capture) {\r
-                    if (eventName == 'mouseenter') {\r
-                        fn = fn.createInterceptor(checkRelatedTarget);\r
-                        el.addEventListener(MOUSEOVER, fn, (capture));\r
-                    } else if (eventName == 'mouseleave') {\r
-                        fn = fn.createInterceptor(checkRelatedTarget);\r
-                        el.addEventListener(MOUSEOUT, fn, (capture));\r
-                    } else {\r
-                        el.addEventListener(eventName, fn, (capture));\r
-                    }\r
-                    return fn;\r
-                };\r
-            } else if (win.attachEvent) {\r
-                ret = function(el, eventName, fn, capture) {\r
-                    el.attachEvent("on" + eventName, fn);\r
-                    return fn;\r
-                };\r
-            } else {\r
-                ret = function(){};\r
-            }\r
-            return ret;\r
-        }(),    \r
-        // private\r
-        doRemove = function(){\r
-            var ret;\r
-            if (win.removeEventListener) {\r
-                ret = function (el, eventName, fn, capture) {\r
-                    if (eventName == 'mouseenter') {\r
-                        eventName = MOUSEOVER;\r
-                    } else if (eventName == 'mouseleave') {\r
-                        eventName = MOUSEOUT;\r
-                    }                        \r
-                    el.removeEventListener(eventName, fn, (capture));\r
-                };\r
-            } else if (win.detachEvent) {\r
-                ret = function (el, eventName, fn) {\r
-                    el.detachEvent("on" + eventName, fn);\r
-                };\r
-            } else {\r
-                ret = function(){};\r
-            }\r
-            return ret;\r
-        }();        \r
-        \r
-    function checkRelatedTarget(e) {\r
-        return !elContains(e.currentTarget, pub.getRelatedTarget(e));\r
-    }\r
-\r
-    function elContains(parent, child) {\r
-       if(parent && parent.firstChild){  \r
-         while(child) {\r
-            if(child === parent) {\r
-                return true;\r
-            }\r
-            child = child.parentNode;            \r
-            if(child && (child.nodeType != 1)) {\r
-                child = null;\r
-            }\r
-          }\r
-        }\r
-        return false;\r
-    }\r
-\r
-        \r
-    // private  \r
-    function _getCacheIndex(el, eventName, fn) {\r
-        for(var v, index = -1, len = listeners.length, i = len - 1; i >= 0; --i){\r
-            v = listeners[i];\r
-            if (v && v[FN] == fn && v[EL] == el && v[TYPE] == eventName) {\r
-                index = i;\r
-                break;\r
-            }\r
-        }\r
-        return index;\r
-    }\r
-                    \r
-    // private\r
-    function _tryPreloadAttach() {\r
-        var ret = false,                \r
-            notAvail = [],\r
-            element,\r
-            tryAgain = !loadComplete || (retryCount > 0);                       \r
-        \r
-        if (!locked) {\r
-            locked = true;\r
-            \r
-            Ext.each(onAvailStack, function (v,i,a){\r
-                if(v && (element = doc.getElementById(v.id))){\r
-                    if(!v.checkReady || loadComplete || element.nextSibling || (doc && doc.body)) {\r
-                        element = v.override ? (v.override === true ? v.obj : v.override) : element;\r
-                        v.fn.call(element, v.obj);\r
-                        onAvailStack[i] = null;\r
-                    } else {\r
-                        notAvail.push(v);\r
-                    }\r
-                }   \r
-            });\r
-\r
-            retryCount = (notAvail.length === 0) ? 0 : retryCount - 1;\r
-\r
-            if (tryAgain) { \r
-                startInterval();\r
-            } else {\r
-                clearInterval(_interval);\r
-                _interval = null;\r
-            }\r
-\r
-            ret = !(locked = false);\r
-        }\r
-        return ret;\r
-    }\r
-    \r
-    // private              \r
-    function startInterval() {            \r
-        if(!_interval){                    \r
-            var callback = function() {\r
-                _tryPreloadAttach();\r
-            };\r
-            _interval = setInterval(callback, POLL_INTERVAL);\r
-        }\r
-    }\r
-    \r
-    // private \r
-    function getScroll() {\r
-        var dd = doc.documentElement, \r
-            db = doc.body;\r
-        if(dd && (dd[SCROLLTOP] || dd[SCROLLLEFT])){\r
-            return [dd[SCROLLLEFT], dd[SCROLLTOP]];\r
-        }else if(db){\r
-            return [db[SCROLLLEFT], db[SCROLLTOP]];\r
-        }else{\r
-            return [0, 0];\r
-        }\r
-    }\r
-        \r
-    // private\r
-    function getPageCoord (ev, xy) {\r
-        ev = ev.browserEvent || ev;\r
-        var coord  = ev['page' + xy];\r
-        if (!coord && coord !== 0) {\r
-            coord = ev['client' + xy] || 0;\r
-\r
-            if (Ext.isIE) {\r
-                coord += getScroll()[xy == "X" ? 0 : 1];\r
-            }\r
-        }\r
-\r
-        return coord;\r
-    }\r
-\r
-    var pub =  {\r
-        onAvailable : function(p_id, p_fn, p_obj, p_override) {             \r
-            onAvailStack.push({ \r
-                id:         p_id,\r
-                fn:         p_fn,\r
-                obj:        p_obj,\r
-                override:   p_override,\r
-                checkReady: false });\r
-\r
-            retryCount = POLL_RETRYS;\r
-            startInterval();\r
-        },\r
-\r
-\r
-        addListener: function(el, eventName, fn) {\r
-            var ret;                \r
-            el = Ext.getDom(el);                \r
-            if (el && fn) {\r
-                if (UNLOAD == eventName) {\r
-                    ret = !!(unloadListeners[unloadListeners.length] = [el, eventName, fn]);                    \r
-                } else {\r
-                    listeners.push([el, eventName, fn, ret = doAdd(el, eventName, fn, false)]);\r
-                }\r
-            }\r
-            return !!ret;\r
-        },\r
-\r
-        removeListener: function(el, eventName, fn) {\r
-            var ret = false,\r
-                index, \r
-                cacheItem;\r
-\r
-            el = Ext.getDom(el);\r
-\r
-            if(!fn) {                   \r
-                ret = this.purgeElement(el, false, eventName);\r
-            } else if (UNLOAD == eventName) {   \r
-                Ext.each(unloadListeners, function(v, i, a) {\r
-                    if( v && v[0] == el && v[1] == eventName && v[2] == fn) {\r
-                        unloadListeners.splice(i, 1);\r
-                        ret = true;\r
-                    }\r
-                });\r
-            } else {    \r
-                index = arguments[3] || _getCacheIndex(el, eventName, fn);\r
-                cacheItem = listeners[index];\r
-                \r
-                if (el && cacheItem) {\r
-                    doRemove(el, eventName, cacheItem[WFN], false);     \r
-                    cacheItem[WFN] = cacheItem[FN] = null;                       \r
-                    listeners.splice(index, 1);     \r
-                    ret = true;\r
-                }\r
-            }\r
-            return ret;\r
-        },\r
-\r
-        getTarget : function(ev) {\r
-            ev = ev.browserEvent || ev;                \r
-            return this.resolveTextNode(ev.target || ev.srcElement);\r
-        },\r
-\r
-        resolveTextNode : Ext.isGecko ? function(node){\r
-            if(!node){\r
-                return;\r
-            }\r
-            // work around firefox bug, https://bugzilla.mozilla.org/show_bug.cgi?id=101197\r
-            var s = HTMLElement.prototype.toString.call(node);\r
-            if(s == '[xpconnect wrapped native prototype]' || s == '[object XULElement]'){\r
-                return;\r
-            }\r
-            return node.nodeType == 3 ? node.parentNode : node;\r
-        } : function(node){\r
-            return node && node.nodeType == 3 ? node.parentNode : node;\r
-        },\r
-\r
-        getRelatedTarget : function(ev) {\r
-            ev = ev.browserEvent || ev;\r
-            return this.resolveTextNode(ev.relatedTarget || \r
-                    (ev.type == MOUSEOUT ? ev.toElement :\r
-                     ev.type == MOUSEOVER ? ev.fromElement : null));\r
-        },\r
-        \r
-        getPageX : function(ev) {\r
-            return getPageCoord(ev, "X");\r
-        },\r
-\r
-        getPageY : function(ev) {\r
-            return getPageCoord(ev, "Y");\r
-        },\r
-\r
-\r
-        getXY : function(ev) {                             \r
-            return [this.getPageX(ev), this.getPageY(ev)];\r
-        },\r
-\r
-// Is this useful?  Removing to save space unless use case exists.\r
-//             getTime: function(ev) {\r
-//                 ev = ev.browserEvent || ev;\r
-//                 if (!ev.time) {\r
-//                     var t = new Date().getTime();\r
-//                     try {\r
-//                         ev.time = t;\r
-//                     } catch(ex) {\r
-//                         return t;\r
-//                     }\r
-//                 }\r
-\r
-//                 return ev.time;\r
-//             },\r
-\r
-        stopEvent : function(ev) {                            \r
-            this.stopPropagation(ev);\r
-            this.preventDefault(ev);\r
-        },\r
-\r
-        stopPropagation : function(ev) {\r
-            ev = ev.browserEvent || ev;\r
-            if (ev.stopPropagation) {\r
-                ev.stopPropagation();\r
-            } else {\r
-                ev.cancelBubble = true;\r
-            }\r
-        },\r
-\r
-        preventDefault : function(ev) {\r
-            ev = ev.browserEvent || ev;\r
-            if (ev.preventDefault) {\r
-                ev.preventDefault();\r
-            } else {\r
-                ev.returnValue = false;\r
-            }\r
-        },\r
-        \r
-        getEvent : function(e) {\r
-            e = e || win.event;\r
-            if (!e) {\r
-                var c = this.getEvent.caller;\r
-                while (c) {\r
-                    e = c.arguments[0];\r
-                    if (e && Event == e.constructor) {\r
-                        break;\r
-                    }\r
-                    c = c.caller;\r
-                }\r
-            }\r
-            return e;\r
-        },\r
-\r
-        getCharCode : function(ev) {\r
-            ev = ev.browserEvent || ev;\r
-            return ev.charCode || ev.keyCode || 0;\r
-        },\r
-\r
-        //clearCache: function() {},\r
-\r
-        _load : function(e) {\r
-            loadComplete = true;\r
-            var EU = Ext.lib.Event;    \r
-            if (Ext.isIE && e !== true) {\r
-        // IE8 complains that _load is null or not an object\r
-        // so lets remove self via arguments.callee\r
-                doRemove(win, "load", arguments.callee);\r
-            }\r
-        },            \r
-        \r
-        purgeElement : function(el, recurse, eventName) {\r
-            var me = this;\r
-            Ext.each( me.getListeners(el, eventName), function(v){\r
-                if(v){\r
-                    me.removeListener(el, v.type, v.fn, v.index);\r
-                }\r
-            });\r
-\r
-            if (recurse && el && el.childNodes) {\r
-                Ext.each(el.childNodes, function(v){\r
-                    me.purgeElement(v, recurse, eventName);\r
-                });\r
-            }\r
-        },\r
-\r
-        getListeners : function(el, eventName) {\r
-            var me = this,\r
-                results = [], \r
-                searchLists;\r
-\r
-            if (eventName){  \r
-                searchLists = eventName == UNLOAD ? unloadListeners : listeners;\r
-            }else{\r
-                searchLists = listeners.concat(unloadListeners);\r
-            }\r
-\r
-            Ext.each(searchLists, function(v, i){\r
-                if (v && v[EL] == el && (!eventName || eventName == v[TYPE])) {\r
-                    results.push({\r
-                                type:   v[TYPE],\r
-                                fn:     v[FN],\r
-                                obj:    v[OBJ],\r
-                                adjust: v[ADJ_SCOPE],\r
-                                index:  i\r
-                            });\r
-                }   \r
-            });                \r
-\r
-            return results.length ? results : null;\r
-        },\r
-\r
-        _unload : function(e) {\r
-             var EU = Ext.lib.Event, \r
-                i, \r
-                j, \r
-                l, \r
-                len, \r
-                index,\r
-                scope;\r
-                \r
-\r
-            Ext.each(unloadListeners, function(v) {\r
-                if (v) {\r
-                    try{\r
-                        scope =  v[ADJ_SCOPE] ? (v[ADJ_SCOPE] === true ? v[OBJ] : v[ADJ_SCOPE]) :  win; \r
-                        v[FN].call(scope, EU.getEvent(e), v[OBJ]);\r
-                    }catch(ex){}\r
-                }   \r
-            });     \r
-\r
-            unloadListeners = null;\r
-\r
-            if(listeners && (j = listeners.length)){                    \r
-                while(j){                        \r
-                    if((l = listeners[index = --j])){\r
-                        EU.removeListener(l[EL], l[TYPE], l[FN], index);\r
-                    }                        \r
-                }\r
-                //EU.clearCache();\r
-            }\r
-\r
-            doRemove(win, UNLOAD, EU._unload);\r
-        }            \r
-    };        \r
-    \r
-    // Initialize stuff.\r
-    pub.on = pub.addListener;\r
-    pub.un = pub.removeListener;\r
-    if (doc && doc.body) {\r
-        pub._load(true);\r
-    } else {\r
-        doAdd(win, "load", pub._load);\r
-    }\r
-    doAdd(win, UNLOAD, pub._unload);    \r
-    _tryPreloadAttach();\r
-    \r
-    return pub;\r
-}();</pre>
-</body>
+<html>\r
+<head>\r
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    \r
+  <title>The source code</title>\r
+    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
+    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
+</head>\r
+<body  onload="prettyPrint();">\r
+    <pre class="prettyprint lang-js">Ext.lib.Event = function() {
+    var loadComplete = false,
+        unloadListeners = {},
+        retryCount = 0,
+        onAvailStack = [],
+        _interval,
+        locked = false,
+        win = window,
+        doc = document,
+
+        // constants
+        POLL_RETRYS = 200,
+        POLL_INTERVAL = 20,
+        EL = 0,
+        TYPE = 0,
+        FN = 1,
+        WFN = 2,
+        OBJ = 2,
+        ADJ_SCOPE = 3,
+        SCROLLLEFT = 'scrollLeft',
+        SCROLLTOP = 'scrollTop',
+        UNLOAD = 'unload',
+        MOUSEOVER = 'mouseover',
+        MOUSEOUT = 'mouseout',
+        // private
+        doAdd = function() {
+            var ret;
+            if (win.addEventListener) {
+                ret = function(el, eventName, fn, capture) {
+                    if (eventName == 'mouseenter') {
+                        fn = fn.createInterceptor(checkRelatedTarget);
+                        el.addEventListener(MOUSEOVER, fn, (capture));
+                    } else if (eventName == 'mouseleave') {
+                        fn = fn.createInterceptor(checkRelatedTarget);
+                        el.addEventListener(MOUSEOUT, fn, (capture));
+                    } else {
+                        el.addEventListener(eventName, fn, (capture));
+                    }
+                    return fn;
+                };
+            } else if (win.attachEvent) {
+                ret = function(el, eventName, fn, capture) {
+                    el.attachEvent("on" + eventName, fn);
+                    return fn;
+                };
+            } else {
+                ret = function(){};
+            }
+            return ret;
+        }(),
+        // private
+        doRemove = function(){
+            var ret;
+            if (win.removeEventListener) {
+                ret = function (el, eventName, fn, capture) {
+                    if (eventName == 'mouseenter') {
+                        eventName = MOUSEOVER;
+                    } else if (eventName == 'mouseleave') {
+                        eventName = MOUSEOUT;
+                    }
+                    el.removeEventListener(eventName, fn, (capture));
+                };
+            } else if (win.detachEvent) {
+                ret = function (el, eventName, fn) {
+                    el.detachEvent("on" + eventName, fn);
+                };
+            } else {
+                ret = function(){};
+            }
+            return ret;
+        }();
+
+    function checkRelatedTarget(e) {
+        return !elContains(e.currentTarget, pub.getRelatedTarget(e));
+    }
+
+    function elContains(parent, child) {
+       if(parent && parent.firstChild){
+         while(child) {
+            if(child === parent) {
+                return true;
+            }
+            child = child.parentNode;
+            if(child && (child.nodeType != 1)) {
+                child = null;
+            }
+          }
+        }
+        return false;
+    }
+
+    // private
+    function _tryPreloadAttach() {
+        var ret = false,
+            notAvail = [],
+            element, i, len, v,
+            tryAgain = !loadComplete || (retryCount > 0);
+
+        if (!locked) {
+            locked = true;
+
+            for (i = 0, len = onAvailStack.length; i < len; i++) {
+                v = onAvailStack[i];
+                if(v && (element = doc.getElementById(v.id))){
+                    if(!v.checkReady || loadComplete || element.nextSibling || (doc && doc.body)) {
+                        element = v.override ? (v.override === true ? v.obj : v.override) : element;
+                        v.fn.call(element, v.obj);
+                        v = null;
+                    } else {
+                        notAvail.push(v);
+                    }
+                }
+            }
+
+            retryCount = (notAvail.length === 0) ? 0 : retryCount - 1;
+
+            if (tryAgain) {
+                startInterval();
+            } else {
+                clearInterval(_interval);
+                _interval = null;
+            }
+
+            ret = !(locked = false);
+        }
+        return ret;
+    }
+
+    // private
+    function startInterval() {
+        if(!_interval){
+            var callback = function() {
+                _tryPreloadAttach();
+            };
+            _interval = setInterval(callback, POLL_INTERVAL);
+        }
+    }
+
+    // private
+    function getScroll() {
+        var dd = doc.documentElement,
+            db = doc.body;
+        if(dd && (dd[SCROLLTOP] || dd[SCROLLLEFT])){
+            return [dd[SCROLLLEFT], dd[SCROLLTOP]];
+        }else if(db){
+            return [db[SCROLLLEFT], db[SCROLLTOP]];
+        }else{
+            return [0, 0];
+        }
+    }
+
+    // private
+    function getPageCoord (ev, xy) {
+        ev = ev.browserEvent || ev;
+        var coord  = ev['page' + xy];
+        if (!coord && coord !== 0) {
+            coord = ev['client' + xy] || 0;
+
+            if (Ext.isIE) {
+                coord += getScroll()[xy == "X" ? 0 : 1];
+            }
+        }
+
+        return coord;
+    }
+
+    var pub =  {
+        extAdapter: true,
+        onAvailable : function(p_id, p_fn, p_obj, p_override) {
+            onAvailStack.push({
+                id:         p_id,
+                fn:         p_fn,
+                obj:        p_obj,
+                override:   p_override,
+                checkReady: false });
+
+            retryCount = POLL_RETRYS;
+            startInterval();
+        },
+
+        // This function should ALWAYS be called from Ext.EventManager
+        addListener: function(el, eventName, fn) {
+            el = Ext.getDom(el);
+            if (el && fn) {
+                if (eventName == UNLOAD) {
+                    if (unloadListeners[el.id] === undefined) {
+                        unloadListeners[el.id] = [];
+                    }
+                    unloadListeners[el.id].push([eventName, fn]);
+                    return fn;
+                }
+                return doAdd(el, eventName, fn, false);
+            }
+            return false;
+        },
+
+        // This function should ALWAYS be called from Ext.EventManager
+        removeListener: function(el, eventName, fn) {
+            el = Ext.getDom(el);
+            var i, len, li;
+            if (el && fn) {
+                if (eventName == UNLOAD) {
+                    if (unloadListeners[id] !== undefined) {
+                        for (i = 0, len = unloadListeners[id].length; i < len; i++) {
+                            li = unloadListeners[id][i];
+                            if (li && li[TYPE] == eventName && li[FN] == fn) {
+                                unloadListeners[id].splice(i, 1);
+                            }
+                        }
+                    }
+                    return;
+                }
+                doRemove(el, eventName, fn, false);
+            }
+        },
+
+        getTarget : function(ev) {
+            ev = ev.browserEvent || ev;
+            return this.resolveTextNode(ev.target || ev.srcElement);
+        },
+
+        resolveTextNode : Ext.isGecko ? function(node){
+            if(!node){
+                return;
+            }
+            // work around firefox bug, https://bugzilla.mozilla.org/show_bug.cgi?id=101197
+            var s = HTMLElement.prototype.toString.call(node);
+            if(s == '[xpconnect wrapped native prototype]' || s == '[object XULElement]'){
+                return;
+            }
+            return node.nodeType == 3 ? node.parentNode : node;
+        } : function(node){
+            return node && node.nodeType == 3 ? node.parentNode : node;
+        },
+
+        getRelatedTarget : function(ev) {
+            ev = ev.browserEvent || ev;
+            return this.resolveTextNode(ev.relatedTarget ||
+                    (ev.type == MOUSEOUT ? ev.toElement :
+                     ev.type == MOUSEOVER ? ev.fromElement : null));
+        },
+
+        getPageX : function(ev) {
+            return getPageCoord(ev, "X");
+        },
+
+        getPageY : function(ev) {
+            return getPageCoord(ev, "Y");
+        },
+
+
+        getXY : function(ev) {
+            return [this.getPageX(ev), this.getPageY(ev)];
+        },
+
+        stopEvent : function(ev) {
+            this.stopPropagation(ev);
+            this.preventDefault(ev);
+        },
+
+        stopPropagation : function(ev) {
+            ev = ev.browserEvent || ev;
+            if (ev.stopPropagation) {
+                ev.stopPropagation();
+            } else {
+                ev.cancelBubble = true;
+            }
+        },
+
+        preventDefault : function(ev) {
+            ev = ev.browserEvent || ev;
+            if (ev.preventDefault) {
+                ev.preventDefault();
+            } else {
+                ev.returnValue = false;
+            }
+        },
+
+        getEvent : function(e) {
+            e = e || win.event;
+            if (!e) {
+                var c = this.getEvent.caller;
+                while (c) {
+                    e = c.arguments[0];
+                    if (e && Event == e.constructor) {
+                        break;
+                    }
+                    c = c.caller;
+                }
+            }
+            return e;
+        },
+
+        getCharCode : function(ev) {
+            ev = ev.browserEvent || ev;
+            return ev.charCode || ev.keyCode || 0;
+        },
+
+        //clearCache: function() {},
+        // deprecated, call from EventManager
+        getListeners : function(el, eventName) {
+            Ext.EventManager.getListeners(el, eventName);
+        },
+
+        // deprecated, call from EventManager
+        purgeElement : function(el, recurse, eventName) {
+            Ext.EventManager.purgeElement(el, recurse, eventName);
+        },
+
+        _load : function(e) {
+            loadComplete = true;
+            var EU = Ext.lib.Event;
+            if (Ext.isIE && e !== true) {
+        // IE8 complains that _load is null or not an object
+        // so lets remove self via arguments.callee
+                doRemove(win, "load", arguments.callee);
+            }
+        },
+
+        _unload : function(e) {
+             var EU = Ext.lib.Event,
+                i, j, l, v, ul, id, len, index, scope;
+
+
+            for (id in unloadListeners) {
+                ul = unloadListeners[id];
+                for (i = 0, len = ul.length; i < len; i++) {
+                    v = ul[i];
+                    if (v) {
+                        try{
+                            scope = v[ADJ_SCOPE] ? (v[ADJ_SCOPE] === true ? v[OBJ] : v[ADJ_SCOPE]) :  win;
+                            v[FN].call(scope, EU.getEvent(e), v[OBJ]);
+                        }catch(ex){}
+                    }
+                }
+            };
+
+            unloadListeners = null;
+            Ext.EventManager._unload();
+
+            doRemove(win, UNLOAD, EU._unload);
+        }
+    };
+
+    // Initialize stuff.
+    pub.on = pub.addListener;
+    pub.un = pub.removeListener;
+    if (doc && doc.body) {
+        pub._load(true);
+    } else {
+        doAdd(win, "load", pub._load);
+    }
+    doAdd(win, UNLOAD, pub._unload);
+    _tryPreloadAttach();
+
+    return pub;
+}();
+</pre>    \r
+</body>\r
 </html>
\ No newline at end of file