[OpenLayers-Dev] [OpenLayers-Trac] [OpenLayers] #880: Event object conflict

Christopher Schmidt crschmidt at metacarta.com
Sat Aug 4 08:48:16 EDT 2007


Paul --

Can you glance at this and offer feedback? I think this answers your
questions, and perhaps adequately resolves them until 3.0?

-- Chris

On Sat, Aug 04, 2007 at 12:45:29PM -0000, OpenLayers wrote:
> #880: Event object conflict
> Comment (by crschmidt):
> 
>  The reason for originally having Event in the main namespace is that we
>  had encouraged people (through 2.0, I think) to use Event.stop in their
>  client code. We now only use OpenLayers.Event internally, but we wanted to
>  ensure that users who had used 'Event.stop' would not have their
>  applications break.
> 
>  Looking at the prototype code, it seems like Prototype will extend any
>  Event object it finds. This means that we should, I think, be able to
>  change:
> 
>  if (window.Event) {
>    OpenLayers.Util.extend(window.Event, OpenLayers.Event);
>  } else {
>    var Event = OpenLayers.Event;
>  }
> 
>  to just:
> 
>  if (!window.Event) {
>    var Event = OpenLayers.Event;
>  }
> 
>  That way, users who are not using Prototype and are using Event.stop will
>  get their stop still.
> 
>  Then, in 3.0, we remove it.



-- 
Christopher Schmidt
MetaCarta



More information about the Dev mailing list