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

commits at openlayers.org commits at openlayers.org
Thu Dec 7 16:18:25 EST 2006


Author: crschmidt
Date: 2006-12-07 16:18:24 -0500 (Thu, 07 Dec 2006)
New Revision: 2024

Modified:
   trunk/openlayers/lib/OpenLayers/Events.js
Log:
A fix for #440. Prevent people who somehow get a null element in the event
cache from shooting themselves in the foot: This doesn't seem to happen often,
but it has happened in internal code. I'm going to add more debugging info to 
#440 as we get it, but want to get this in to prevent people from shooting 
themselves in the foot in IE accidentally.


Modified: trunk/openlayers/lib/OpenLayers/Events.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Events.js	2006-12-07 18:17:28 UTC (rev 2023)
+++ trunk/openlayers/lib/OpenLayers/Events.js	2006-12-07 21:18:24 UTC (rev 2024)
@@ -96,9 +96,9 @@
         || element.detachEvent))
       name = 'keydown';
 
-    if (element.removeEventListener) {
+    if (element && element.removeEventListener) {
       element.removeEventListener(name, observer, useCapture);
-    } else if (element.detachEvent) {
+    } else if (element && element.detachEvent) {
       element.detachEvent('on' + name, observer);
     }
   }



More information about the Commits mailing list