From 71276b5323a5181bf9cdf90bb02ad07f2cebb1a0 Mon Sep 17 00:00:00 2001 From: tschaub Date: Fri, 2 Mar 2012 16:52:11 -0700 Subject: [PATCH] Fixing the extend method to work on IE. In IE, events don't have a `hasOwnProperty` method. Instead of trusting that the source objects have this method, we call the same on the Object prototype. If we want to be safer about the `hasOwnProperty` calling done in e3cc96dbfb58ee873db457e74de7c7774a25bf45, we could create an `OpenLayers.Object.has` method that also used the Object prototype. --- lib/OpenLayers/BaseTypes/Class.js | 2 +- tests/Util.html | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers/BaseTypes/Class.js b/lib/OpenLayers/BaseTypes/Class.js index 1e242f55bb..6f64d3f961 100644 --- a/lib/OpenLayers/BaseTypes/Class.js +++ b/lib/OpenLayers/BaseTypes/Class.js @@ -91,7 +91,7 @@ OpenLayers.Util.extend = function(destination, source) { destination = destination || {}; if (source) { for (var property in source) { - if (source.hasOwnProperty(property)) { + if (Object.prototype.hasOwnProperty.call(source, property)) { var value = source[property]; if (value !== undefined) { destination[property] = value; diff --git a/tests/Util.html b/tests/Util.html index 43db83c06d..e137d0f7ce 100644 --- a/tests/Util.html +++ b/tests/Util.html @@ -1120,10 +1120,34 @@ t.eq(OpenLayers.Util.getFormattedLonLat(-181, "lon"), "179°00'00\"E", "crossing dateline from the west results in correct east coordinate"); t.eq(OpenLayers.Util.getFormattedLonLat(181, "lon"), "179°00'00\"W", "crossing dateline from the east results in correct west coordinate"); } -
+