[OpenLayers-Commits] r10873 - trunk/openlayers/lib/OpenLayers

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Fri Nov 5 10:07:41 EDT 2010


Author: fredj
Date: 2010-11-05 07:07:40 -0700 (Fri, 05 Nov 2010)
New Revision: 10873

Modified:
   trunk/openlayers/lib/OpenLayers/Events.js
Log:
handleBrowserEvent: don't compute mouse position if it's not needed. r=erilem (closes #2880)

Modified: trunk/openlayers/lib/OpenLayers/Events.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Events.js	2010-11-05 14:05:41 UTC (rev 10872)
+++ trunk/openlayers/lib/OpenLayers/Events.js	2010-11-05 14:07:40 UTC (rev 10873)
@@ -786,10 +786,15 @@
      * 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);
     },
 
     /**



More information about the Commits mailing list