diff --git a/lib/OpenLayers/Events.js b/lib/OpenLayers/Events.js index bbfb846302..e293bcdef0 100644 --- a/lib/OpenLayers/Events.js +++ b/lib/OpenLayers/Events.js @@ -326,8 +326,10 @@ OpenLayers.Event.observe(window, 'unload', OpenLayers.Event.unloadCache, false); // FIXME: Remove this in 3.0. In 3.0, Event.stop will no longer be provided // by OpenLayers. -if (!window.Event) { - var Event = OpenLayers.Event; +if (window.Event) { + OpenLayers.Util.applyDefaults(window.Event, OpenLayers.Event); +} else { + var Event = OpenLayers.Event; } /** diff --git a/tests/test_Events.html b/tests/test_Events.html index 729b2851df..57cb5c50f1 100644 --- a/tests/test_Events.html +++ b/tests/test_Events.html @@ -332,6 +332,11 @@ t.eq( events.listeners["doThingA"].length, 1, "event type passed to addEventType correctly does nothing if clashes with already defined event type" ); } + /** HACK HACK HACK Deprecated This test should be removed in 3.0 **/ + function test_Events_globalEventObject(t) { + t.plan(1); + t.ok(Event.stop, "a stop() function exists on the global JS Event object, if indeed it exists. This is legacy deprecated and will be gone in 3.0"); + }