From 34c52fb5a8fe1ce8ebf0c52a2e33fda048d13bcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Junod?= Date: Fri, 5 Nov 2010 14:07:40 +0000 Subject: [PATCH] handleBrowserEvent: don't compute mouse position if it's not needed. r=erilem (closes #2880) git-svn-id: http://svn.openlayers.org/trunk/openlayers@10873 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Events.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/Events.js b/lib/OpenLayers/Events.js index 82f4beb2a1..9f4b13a965 100644 --- a/lib/OpenLayers/Events.js +++ b/lib/OpenLayers/Events.js @@ -786,10 +786,15 @@ OpenLayers.Events = OpenLayers.Class({ * evt - {Event} */ handleBrowserEvent: function (evt) { + var type = evt.type, listeners = this.listeners[type]; + if(!listeners || listeners.length == 0) { + // none's listening, bail out + return; + } if (this.includeXY) { evt.xy = this.getMousePosition(evt); } - this.triggerEvent(evt.type, evt); + this.triggerEvent(type, evt); }, /**