OpenLayers OpenLayers

Ticket #1480: patch-1480-r6762-A0.diff

File patch-1480-r6762-A0.diff, 2.1 kB (added by elemoine, 9 months ago)
  • lib/OpenLayers/Util.js

    old new  
    5656                destination[property] = value; 
    5757            } 
    5858        } 
     59 
    5960        /** 
    6061         * IE doesn't include the toString property when iterating over an object's 
    6162         * properties with the for(property in object) syntax.  Explicitly check if 
    6263         * the source has its own toString property. 
    6364         */ 
    64         if(source.hasOwnProperty && source.hasOwnProperty('toString')) { 
     65 
     66        /* 
     67         * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative 
     68         * prototype object" when calling hawOwnProperty if the source object 
     69         * is an instance of window.Event. 
     70         */ 
     71 
     72        var sourceIsEvt = typeof window.Event == "function" 
     73                          && source instanceof window.Event; 
     74 
     75        if(!sourceIsEvt 
     76           && source.hasOwnProperty && source.hasOwnProperty('toString')) { 
    6577            destination.toString = source.toString; 
    6678        } 
    6779    } 
     
    510522 *     in place and returned by this function. 
    511523 */ 
    512524OpenLayers.Util.applyDefaults = function (to, from) { 
     525 
     526    /* 
     527     * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative 
     528     * prototype object" when calling hawOwnProperty if the source object is an 
     529     * instance of window.Event. 
     530     */ 
     531    var fromIsEvt = typeof window.Event == "function" 
     532                    && from instanceof window.Event; 
     533 
    513534    for (var key in from) { 
    514535        if (to[key] === undefined || 
    515             (from.hasOwnProperty 
     536            (!fromIsEvt && from.hasOwnProperty 
    516537             && from.hasOwnProperty(key) && !to.hasOwnProperty(key))) { 
    517538            to[key] = from[key]; 
    518539        } 
     
    522543     * properties with the for(property in object) syntax.  Explicitly check if 
    523544     * the source has its own toString property. 
    524545     */ 
    525     if(from.hasOwnProperty 
     546    if(!fromIsEvt && from.hasOwnProperty 
    526547       && from.hasOwnProperty('toString') && !to.hasOwnProperty('toString')) { 
    527548        to.toString = from.toString; 
    528549    }