[OpenLayers-Dev] OpenLayers and Prototype conflict in IE

gingerbbm stuart.jones at jacobs.com
Wed Feb 24 13:26:11 EST 2010

I've done some more digging. I've constructed a script that loads the
relevant OpenLayers library scripts in the requisite order (deduced by
peforming a successful build). Before each script loads I check for
Event.pointerX and perhaps unsurprisingly it's becoming undefined after
Events.js loads.

I broke Events.js down and the problem is in this code:

    // FIXME: Remove this in 3.0. In 3.0, Event.stop will no longer be
    // by OpenLayers.
    if (window.Event) {
        OpenLayers.Util.applyDefaults(window.Event, OpenLayers.Event);
    } else {
        var Event = OpenLayers.Event;

For some reason IE is thinking that window.Event is false and is creating a
new Event object, thus overwriting the Prototype Event object. I've tried
forcing it to hit the OpenLayers.Util.applyDefaults() line but then I get an
exception about the method not being supported.

As the comment suggests, perhaps this code can simply be removed. Certainly
in my test rig that seems to work. I need to test this more but if anyone
has anything to contribute I'm all ears.

View this message in context: http://n2.nabble.com/OpenLayers-and-Prototype-conflict-in-IE-tp4591037p4627621.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.

More information about the Dev mailing list