#875 - protect global property variable - with regression test

git-svn-id: http://svn.openlayers.org/trunk/openlayers@3837 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2007-08-02 17:45:19 +00:00
parent c733d7bcff
commit e9a488c264
2 changed files with 3 additions and 2 deletions

View File

@@ -49,7 +49,7 @@ if ($ == null) {
*/ */
OpenLayers.Util.extend = function(destination, source) { OpenLayers.Util.extend = function(destination, source) {
if(destination && source) { if(destination && source) {
for(property in source) { for(var property in source) {
destination[property] = source[property]; destination[property] = source[property];
} }
/** /**

View File

@@ -580,7 +580,7 @@
} }
function tests_Util_extend(t) { function tests_Util_extend(t) {
t.plan(4); t.plan(5);
var source = { var source = {
num: Math.random(), num: Math.random(),
obj: { obj: {
@@ -602,6 +602,7 @@
"extend properly sets function property on destination"); "extend properly sets function property on destination");
t.eq(destination.toString(), "source", t.eq(destination.toString(), "source",
"extend properly sets custom toString method"); "extend properly sets custom toString method");
t.eq(window.property, undefined, "Property variable not clobbered.");
} }
function test_XX_Util_Try(t) { function test_XX_Util_Try(t) {