Changeset 7311
- Timestamp:
- 06/05/08 16:37:40 (6 months ago)
- Files:
-
- trunk/openlayers/lib/OpenLayers/Format/KML.js (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Layer/KaMap.js (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Layer/MapServer.js (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Layer/WFS.js (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Layer/WorldWind.js (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Map.js (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Util.js (modified) (2 diffs)
- trunk/openlayers/tests/Util.html (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/lib/OpenLayers/Format/KML.js
r6748 r7311 551 551 var inlineStyle= this.parseStyle(inlineStyleNode); 552 552 if (inlineStyle) { 553 feature.style = OpenLayers.Util.extend( {},554 feature.style);555 OpenLayers.Util.extend(feature.style, inlineStyle);553 feature.style = OpenLayers.Util.extend( 554 feature.style, inlineStyle 555 ); 556 556 } 557 557 } trunk/openlayers/lib/OpenLayers/Layer/KaMap.js
r6748 r7311 65 65 newArguments.push(name, url, params, options); 66 66 OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments); 67 this.params = (params ? params : {}); 68 if (params) { 69 OpenLayers.Util.applyDefaults( 70 this.params, 71 this.DEFAULT_PARAMS 72 ); 73 } 67 this.params = OpenLayers.Util.applyDefaults( 68 this.params, this.DEFAULT_PARAMS 69 ); 74 70 }, 75 71 trunk/openlayers/lib/OpenLayers/Layer/MapServer.js
r6418 r7311 43 43 OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments); 44 44 45 if (arguments.length > 0) { 46 OpenLayers.Util.applyDefaults( 47 this.params, 48 this.DEFAULT_PARAMS 49 ); 50 } 45 this.params = OpenLayers.Util.applyDefaults( 46 this.params, this.DEFAULT_PARAMS 47 ); 51 48 52 49 // unless explicitly set in options, if the layer is transparent, trunk/openlayers/lib/OpenLayers/Layer/WFS.js
r6495 r7311 139 139 } 140 140 141 this.params = params; 142 OpenLayers.Util.applyDefaults( 143 this.params, 144 OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS) 145 ); 141 this.params = OpenLayers.Util.applyDefaults( 142 params, 143 OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS) 144 ); 146 145 this.url = url; 147 146 }, trunk/openlayers/lib/OpenLayers/Layer/WorldWind.js
r6418 r7311 55 55 newArguments.push(name, url, params, options); 56 56 OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments); 57 this.params = (params ? params : {}); 58 if (params) { 59 OpenLayers.Util.applyDefaults( 60 this.params, 61 this.DEFAULT_PARAMS 62 ); 63 } 57 this.params = OpenLayers.Util.applyDefaults( 58 this.params, this.DEFAULT_PARAMS 59 ); 64 60 }, 65 61 /** trunk/openlayers/lib/OpenLayers/Map.js
r7190 r7311 1336 1336 */ 1337 1337 pan: function(dx, dy, options) { 1338 // this should be pushed to applyDefaults and extend 1339 if (!options) { 1340 options = {}; 1341 } 1342 OpenLayers.Util.applyDefaults(options, { 1338 options = OpenLayers.Util.applyDefaults(options, { 1343 1339 animate: true, 1344 1340 dragging: false trunk/openlayers/lib/OpenLayers/Util.js
r7299 r7311 50 50 */ 51 51 OpenLayers.Util.extend = function(destination, source) { 52 if(destination && source) { 52 destination = destination || {}; 53 if(source) { 53 54 for(var property in source) { 54 55 var value = source[property]; … … 523 524 */ 524 525 OpenLayers.Util.applyDefaults = function (to, from) { 525 526 to = to || {}; 526 527 /* 527 528 * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative trunk/openlayers/tests/Util.html
r7308 r7311 170 170 function test_Util_applyDefaults(t) { 171 171 172 t.plan(1 0);172 t.plan(11); 173 173 174 174 var to = { … … 199 199 t.eq(to.toString(), "works", "correctly applies custom toString"); 200 200 t.eq(to.n, null, "correctly preserves null"); 201 202 var to; 203 var from = {rand: Math.random()}; 204 205 var ret = OpenLayers.Util.applyDefaults(to, from); 206 t.eq(ret.rand, from.rand, "works with undefined to"); 201 207 } 202 208 … … 710 716 711 717 function tests_Util_extend(t) { 712 t.plan( 6);718 t.plan(7); 713 719 714 720 var source = { … … 737 743 "undefined source properties don't clobber existing properties"); 738 744 t.eq(window.property, undefined, "Property variable not clobbered."); 745 746 var destination; 747 var source = {rand: Math.random()}; 748 var ret = OpenLayers.Util.extend(destination, source); 749 t.eq(destination.rand, source.rand, "works with undefined destination"); 750 739 751 } 740 752
