X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..25ef3491bd9ae007ff1fc2b0d7943e6eaaccf775:/src/adapter/core/ext-base-event.js diff --git a/src/adapter/core/ext-base-event.js b/src/adapter/core/ext-base-event.js index da95eb23..bada63de 100644 --- a/src/adapter/core/ext-base-event.js +++ b/src/adapter/core/ext-base-event.js @@ -1,5 +1,5 @@ /*! - * Ext JS Library 3.0.0 + * Ext JS Library 3.0.3 * Copyright(c) 2006-2009 Ext JS, LLC * licensing@extjs.com * http://www.extjs.com/license @@ -76,25 +76,9 @@ Ext.lib.Event = function() { } return ret; }(); - - var isXUL = Ext.isGecko ? function(node){ - return Object.prototype.toString.call(node) == '[object XULElement]'; - } : function(){}; - - var isTextNode = Ext.isGecko ? function(node){ - try{ - return node.nodeType == 3; - }catch(e) { - return false; - } - - } : function(node){ - return node.nodeType == 3; - }; function checkRelatedTarget(e) { - var related = pub.getRelatedTarget(e); - return !(isXUL(related) || elContains(e.currentTarget,related)); + return !elContains(e.currentTarget, pub.getRelatedTarget(e)); } function elContains(parent, child) { @@ -103,16 +87,7 @@ Ext.lib.Event = function() { if(child === parent) { return true; } - try { - child = child.parentNode; - } catch(e) { - // In FF if you mouseout an text input element - // thats inside a div sometimes it randomly throws - // Permission denied to get property HTMLDivElement.parentNode - // See https://bugzilla.mozilla.org/show_bug.cgi?id=208427 - - return false; - } + child = child.parentNode; if(child && (child.nodeType != 1)) { child = null; } @@ -124,12 +99,13 @@ Ext.lib.Event = function() { // private function _getCacheIndex(el, eventName, fn) { - var index = -1; - Ext.each(listeners, function (v,i) { - if(v && v[FN] == fn && v[EL] == el && v[TYPE] == eventName) { + for(var v, index = -1, len = listeners.length, i = len - 1; i >= 0; --i){ + v = listeners[i]; + if (v && v[FN] == fn && v[EL] == el && v[TYPE] == eventName) { index = i; + break; } - }); + } return index; } @@ -269,8 +245,18 @@ Ext.lib.Event = function() { return this.resolveTextNode(ev.target || ev.srcElement); }, - resolveTextNode : function(node) { - return node && !isXUL(node) && isTextNode(node) ? node.parentNode : node; + 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) { @@ -367,7 +353,7 @@ Ext.lib.Event = function() { var me = this; Ext.each( me.getListeners(el, eventName), function(v){ if(v){ - me.removeListener(el, v.type, v.fn); + me.removeListener(el, v.type, v.fn, v.index); } });