as universally approved on discussions on dev list, replace new Object() with {}. all tests pass ff & ie6

git-svn-id: http://svn.openlayers.org/trunk/openlayers@3814 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2007-07-25 22:39:28 +00:00
parent 6d2e84892d
commit 5f0bde51da
19 changed files with 29 additions and 29 deletions

View File

@@ -429,7 +429,7 @@ OpenLayers.Bounds = OpenLayers.Class({
* merely a copy of this one. * merely a copy of this one.
*/ */
wrapDateLine: function(maxExtent, options) { wrapDateLine: function(maxExtent, options) {
options = options || new Object(); options = options || {};
var leftTolerance = options.leftTolerance || 0; var leftTolerance = options.leftTolerance || 0;
var rightTolerance = options.rightTolerance || 0; var rightTolerance = options.rightTolerance || 0;

View File

@@ -32,7 +32,7 @@ OpenLayers.Class = function() {
this.initialize.apply(this, arguments); this.initialize.apply(this, arguments);
} }
} }
var extended = new Object(); var extended = {};
var parent; var parent;
for(var i=0; i<arguments.length; ++i) { for(var i=0; i<arguments.length; ++i) {
if(typeof arguments[i] == "function") { if(typeof arguments[i] == "function") {

View File

@@ -74,7 +74,7 @@ OpenLayers.Control.MouseToolbar = OpenLayers.Class(
draw: function() { draw: function() {
OpenLayers.Control.prototype.draw.apply(this, arguments); OpenLayers.Control.prototype.draw.apply(this, arguments);
OpenLayers.Control.MouseDefaults.prototype.draw.apply(this, arguments); OpenLayers.Control.MouseDefaults.prototype.draw.apply(this, arguments);
this.buttons = new Object(); this.buttons = {};
var sz = new OpenLayers.Size(28,28); var sz = new OpenLayers.Size(28,28);
var centered = new OpenLayers.Pixel(OpenLayers.Control.MouseToolbar.X,0); var centered = new OpenLayers.Pixel(OpenLayers.Control.MouseToolbar.X,0);
this._addButton("zoombox", "drag-rectangle-off.png", "drag-rectangle-on.png", centered, sz, "Shift->Drag to zoom to area"); this._addButton("zoombox", "drag-rectangle-off.png", "drag-rectangle-on.png", centered, sz, "Shift->Drag to zoom to area");

View File

@@ -171,7 +171,7 @@ OpenLayers.Event = {
//if observers cache has not yet been created, create it //if observers cache has not yet been created, create it
if (!this.observers) { if (!this.observers) {
this.observers = new Object(); this.observers = {};
} }
//if not already assigned, make a new unique cache ID //if not already assigned, make a new unique cache ID
@@ -398,7 +398,7 @@ OpenLayers.Events = OpenLayers.Class({
this.element = element; this.element = element;
this.eventTypes = eventTypes; this.eventTypes = eventTypes;
this.fallThrough = fallThrough; this.fallThrough = fallThrough;
this.listeners = new Object(); this.listeners = {};
// keep a bound copy of handleBrowserEvent() so that we can // keep a bound copy of handleBrowserEvent() so that we can
// pass the same function to both Event.observe() and .stopObserving() // pass the same function to both Event.observe() and .stopObserving()
@@ -589,7 +589,7 @@ OpenLayers.Events = OpenLayers.Class({
// prep evt object with object & div references // prep evt object with object & div references
if (evt == null) { if (evt == null) {
evt = new Object(); evt = {};
} }
evt.object = this.object; evt.object = this.object;
evt.element = this.element; evt.element = this.element;

View File

@@ -70,7 +70,7 @@ OpenLayers.Feature = OpenLayers.Class({
initialize: function(layer, lonlat, data) { initialize: function(layer, lonlat, data) {
this.layer = layer; this.layer = layer;
this.lonlat = lonlat; this.lonlat = lonlat;
this.data = (data != null) ? data : new Object(); this.data = (data != null) ? data : {};
this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_"); this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
}, },

View File

@@ -74,7 +74,7 @@ OpenLayers.Feature.Vector = OpenLayers.Class(OpenLayers.Feature, {
this.lonlat = null; this.lonlat = null;
this.geometry = geometry; this.geometry = geometry;
this.state = null; this.state = null;
this.attributes = new Object(); this.attributes = {};
if (attributes) { if (attributes) {
this.attributes = OpenLayers.Util.extend(this.attributes, this.attributes = OpenLayers.Util.extend(this.attributes,
attributes); attributes);

View File

@@ -315,7 +315,7 @@ OpenLayers.Layer = OpenLayers.Class({
addOptions: function (newOptions) { addOptions: function (newOptions) {
if (this.options == null) { if (this.options == null) {
this.options = new Object(); this.options = {};
} }
// update our copy for clone // update our copy for clone
@@ -569,7 +569,7 @@ OpenLayers.Layer = OpenLayers.Class({
// resolution-related properties that we find in either the layer's // resolution-related properties that we find in either the layer's
// 'options' array or from the map. // 'options' array or from the map.
// //
var confProps = new Object(); var confProps = {};
for(var i=0; i < props.length; i++) { for(var i=0; i < props.length; i++) {
var property = props[i]; var property = props[i];
confProps[property] = this.options[property] || this.map[property]; confProps[property] = this.options[property] || this.map[property];

View File

@@ -56,7 +56,7 @@ OpenLayers.Layer.HTTPRequest = OpenLayers.Class(OpenLayers.Layer, {
newArguments = [name, options]; newArguments = [name, options];
OpenLayers.Layer.prototype.initialize.apply(this, newArguments); OpenLayers.Layer.prototype.initialize.apply(this, newArguments);
this.url = url; this.url = url;
this.params = OpenLayers.Util.extend( new Object(), params); this.params = OpenLayers.Util.extend( {}, params);
}, },
/** /**
@@ -167,7 +167,7 @@ OpenLayers.Layer.HTTPRequest = OpenLayers.Class(OpenLayers.Layer, {
// create a new params hashtable with all the layer params and the // create a new params hashtable with all the layer params and the
// new params together. then convert to string // new params together. then convert to string
var allParams = OpenLayers.Util.extend(new Object(), this.params); var allParams = OpenLayers.Util.extend({}, this.params);
allParams = OpenLayers.Util.extend(allParams, newParams); allParams = OpenLayers.Util.extend(allParams, newParams);
var paramsString = OpenLayers.Util.getParameterString(allParams); var paramsString = OpenLayers.Util.getParameterString(allParams);

View File

@@ -153,7 +153,7 @@ OpenLayers.Layer.MapServer = OpenLayers.Class(OpenLayers.Layer.Grid, {
// create a new params hashtable with all the layer params and the // create a new params hashtable with all the layer params and the
// new params together. then convert to string // new params together. then convert to string
var allParams = OpenLayers.Util.extend(new Object(), this.params); var allParams = OpenLayers.Util.extend({}, this.params);
allParams = OpenLayers.Util.extend(allParams, newParams); allParams = OpenLayers.Util.extend(allParams, newParams);
// ignore parameters that are already in the url search string // ignore parameters that are already in the url search string
var urlParams = OpenLayers.Util.upperCaseObject( var urlParams = OpenLayers.Util.upperCaseObject(

View File

@@ -120,7 +120,7 @@ OpenLayers.Layer.Text = OpenLayers.Class(OpenLayers.Layer.Markers, {
} }
} }
if (set) { if (set) {
var data = new Object(); var data = {};
if (url != null) { if (url != null) {
data.icon = new OpenLayers.Icon(url, data.icon = new OpenLayers.Icon(url,
iconSize, iconSize,

View File

@@ -6,7 +6,7 @@
/** /**
* Namespace: Util * Namespace: Util
*/ */
OpenLayers.Util = new Object(); OpenLayers.Util = {};
/** /**
* Function: getElement * Function: getElement
@@ -459,7 +459,7 @@ OpenLayers.Util.createAlphaImageDiv = function(id, px, sz, imgURL,
* {Object} A new Object with all the same keys but uppercased * {Object} A new Object with all the same keys but uppercased
*/ */
OpenLayers.Util.upperCaseObject = function (object) { OpenLayers.Util.upperCaseObject = function (object) {
var uObject = new Object(); var uObject = {};
for (var key in object) { for (var key in object) {
uObject[key.toUpperCase()] = object[key]; uObject[key.toUpperCase()] = object[key];
} }
@@ -767,7 +767,7 @@ OpenLayers.Util.getArgs = function(url) {
return {}; return {};
} }
var args = new Object(); var args = {};
pairs = query.split(/[&;]/); pairs = query.split(/[&;]/);
for(var i = 0; i < pairs.length; ++i) { for(var i = 0; i < pairs.length; ++i) {
keyValue = pairs[i].split('='); keyValue = pairs[i].split('=');
@@ -971,7 +971,7 @@ OpenLayers.Util.pagePosition = function(forElement) {
* {Boolean} Whether or not the two URLs are equivalent * {Boolean} Whether or not the two URLs are equivalent
*/ */
OpenLayers.Util.isEquivalentUrl = function(url1, url2, options) { OpenLayers.Util.isEquivalentUrl = function(url1, url2, options) {
options = options || new Object(); options = options || {};
OpenLayers.Util.applyDefaults(options, { OpenLayers.Util.applyDefaults(options, {
ignoreCase: true, ignoreCase: true,
@@ -1041,9 +1041,9 @@ OpenLayers.Util.isEquivalentUrl = function(url1, url2, options) {
* and ready for comparison * and ready for comparison
*/ */
OpenLayers.Util.createUrlObject = function(url, options) { OpenLayers.Util.createUrlObject = function(url, options) {
options = options || new Object(); options = options || {};
var urlObject = new Object(); var urlObject = {};
if (options.ignoreCase) { if (options.ignoreCase) {
url = url.toLowerCase(); url = url.toLowerCase();

View File

@@ -304,7 +304,7 @@
t.ok(bounds.equals(originalBounds), "null to extend does not crash or change original bounds"); t.ok(bounds.equals(originalBounds), "null to extend does not crash or change original bounds");
//obj with no classname //obj with no classname
var object = new Object(); var object = {};
bounds.extend(object); bounds.extend(object);
t.ok(bounds.equals(originalBounds), "extend() passing object with no classname does not crash or change original bounds") t.ok(bounds.equals(originalBounds), "extend() passing object with no classname does not crash or change original bounds")

View File

@@ -78,7 +78,7 @@
layer2 = new OpenLayers.Layer.EventPane('Test Layer'); layer2 = new OpenLayers.Layer.EventPane('Test Layer');
//give dummy function so test wont bomb on layer.setMap() //give dummy function so test wont bomb on layer.setMap()
layer2.loadMapObject = function() { this.mapObject = new Object(); }; layer2.loadMapObject = function() { this.mapObject = {}; };
layer2.getWarningHTML = function() { this.warning = true; return ""; } layer2.getWarningHTML = function() { this.warning = true; return ""; }
map.addLayer(layer2); map.addLayer(layer2);

View File

@@ -114,7 +114,7 @@
layer = new OpenLayers.Layer.MapServer(name, url, params); layer = new OpenLayers.Layer.MapServer(name, url, params);
t.ok( layer.isBaseLayer, "baselayer is true by default"); t.ok( layer.isBaseLayer, "baselayer is true by default");
var newParams = OpenLayers.Util.extend(new Object(), params); var newParams = OpenLayers.Util.extend({}, params);
newParams.transparent = "true"; newParams.transparent = "true";
layer = new OpenLayers.Layer.MapServer(name, url, newParams); layer = new OpenLayers.Layer.MapServer(name, url, newParams);
t.ok( !layer.isBaseLayer, "baselayer is false when transparent is set to true"); t.ok( !layer.isBaseLayer, "baselayer is false when transparent is set to true");

View File

@@ -54,7 +54,7 @@
layer = new OpenLayers.Layer.MapServer.Untiled(name, url, params); layer = new OpenLayers.Layer.MapServer.Untiled(name, url, params);
t.ok( layer.isBaseLayer, "baselayer is true by default"); t.ok( layer.isBaseLayer, "baselayer is true by default");
var newParams = OpenLayers.Util.extend(new Object(), params); var newParams = OpenLayers.Util.extend({}, params);
newParams.transparent = "true"; newParams.transparent = "true";
layer = new OpenLayers.Layer.MapServer.Untiled(name, url, newParams); layer = new OpenLayers.Layer.MapServer.Untiled(name, url, newParams);
t.ok( !layer.isBaseLayer, "baselayer is false when transparent is set to true"); t.ok( !layer.isBaseLayer, "baselayer is false when transparent is set to true");

View File

@@ -138,7 +138,7 @@
layer = new OpenLayers.Layer.WMS(name, url, params); layer = new OpenLayers.Layer.WMS(name, url, params);
t.ok( layer.isBaseLayer, "baselayer is true by default"); t.ok( layer.isBaseLayer, "baselayer is true by default");
var newParams = OpenLayers.Util.extend(new Object(), params); var newParams = OpenLayers.Util.extend({}, params);
newParams.transparent = "true"; newParams.transparent = "true";
layer = new OpenLayers.Layer.WMS(name, url, newParams); layer = new OpenLayers.Layer.WMS(name, url, newParams);
t.ok( !layer.isBaseLayer, "baselayer is false when transparent is set to true"); t.ok( !layer.isBaseLayer, "baselayer is false when transparent is set to true");

View File

@@ -9,7 +9,7 @@
function test_01_Feature_constructor (t) { function test_01_Feature_constructor (t) {
t.plan( 6 ); t.plan( 6 );
var layer = new Object(); var layer = {};
var lonlat = new OpenLayers.LonLat(2,1); var lonlat = new OpenLayers.LonLat(2,1);
var iconURL = 'http://boston.openguides.org/features/ORANGE.png'; var iconURL = 'http://boston.openguides.org/features/ORANGE.png';
var iconSize = new OpenLayers.Size(12, 17); var iconSize = new OpenLayers.Size(12, 17);

View File

@@ -7,7 +7,7 @@
function test_01_Tile_constructor (t) { function test_01_Tile_constructor (t) {
t.plan( 9 ); t.plan( 9 );
var layer = new Object(); // bogus layer var layer = {}; // bogus layer
var position = new OpenLayers.Pixel(10,20); var position = new OpenLayers.Pixel(10,20);
var bounds = new OpenLayers.Bounds(1,2,3,4); var bounds = new OpenLayers.Bounds(1,2,3,4);
var url = "bobob"; var url = "bobob";
@@ -31,7 +31,7 @@
t.plan( 6 ); t.plan( 6 );
var layer = new Object(); // bogus layer var layer = {}; // bogus layer
var position = new OpenLayers.Pixel(10,20); var position = new OpenLayers.Pixel(10,20);
var bounds = new OpenLayers.Bounds(1,2,3,4); var bounds = new OpenLayers.Bounds(1,2,3,4);
var url = "bobob"; var url = "bobob";

View File

@@ -396,7 +396,7 @@
var bKey = "blorg"; var bKey = "blorg";
var bValue = "us maximus"; var bValue = "us maximus";
var obj = new Object(); var obj = {};
obj[aKey] = aValue; obj[aKey] = aValue;
obj[bKey] = bValue; obj[bKey] = bValue;