OpenLayers OpenLayers

Ticket #880: events.3.patch

File events.3.patch, 1.2 kB (added by euzuro, 1 year ago)

TAKE 6!! SAFER AND SOUNDER!!!

  • tests/test_Events.html

    old new  
    332332        t.eq( events.listeners["doThingA"].length, 1, "event type passed to addEventType correctly does nothing if clashes with already defined event type" ); 
    333333    } 
    334334 
     335    /** HACK HACK HACK Deprecated This test should be removed in 3.0 **/ 
     336    function test_Events_globalEventObject(t) { 
     337        t.plan(1); 
     338        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"); 
     339    } 
    335340    
    336341 
    337342  </script> 
  • lib/OpenLayers/Events.js

    old new  
    326326 
    327327// FIXME: Remove this in 3.0. In 3.0, Event.stop will no longer be provided 
    328328// by OpenLayers. 
    329 if (!window.Event) { 
    330   var Event = OpenLayers.Event; 
     329if (window.Event) { 
     330    OpenLayers.Util.applyDefaults(window.Event, OpenLayers.Event); 
     331} else { 
     332    var Event = OpenLayers.Event; 
    331333} 
    332334 
    333335/**