diff --git a/lib/OpenLayers/BaseTypes/Class.js b/lib/OpenLayers/BaseTypes/Class.js index 6f64d3f961..4a900b4198 100644 --- a/lib/OpenLayers/BaseTypes/Class.js +++ b/lib/OpenLayers/BaseTypes/Class.js @@ -91,11 +91,9 @@ OpenLayers.Util.extend = function(destination, source) { destination = destination || {}; if (source) { for (var property in source) { - if (Object.prototype.hasOwnProperty.call(source, property)) { - var value = source[property]; - if (value !== undefined) { - destination[property] = value; - } + var value = source[property]; + if (value !== undefined) { + destination[property] = value; } } diff --git a/lib/OpenLayers/Control/GetFeature.js b/lib/OpenLayers/Control/GetFeature.js index 49760b03d3..c037f87d15 100644 --- a/lib/OpenLayers/Control/GetFeature.js +++ b/lib/OpenLayers/Control/GetFeature.js @@ -258,9 +258,7 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, { activate: function () { if (!this.active) { for(var i in this.handlers) { - if (this.handlers.hasOwnProperty(i)) { - this.handlers[i].activate(); - } + this.handlers[i].activate(); } } return OpenLayers.Control.prototype.activate.apply( @@ -278,9 +276,7 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, { deactivate: function () { if (this.active) { for(var i in this.handlers) { - if (this.handlers.hasOwnProperty(i)) { - this.handlers[i].deactivate(); - } + this.handlers[i].deactivate(); } } return OpenLayers.Control.prototype.deactivate.apply( @@ -564,9 +560,7 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, { unselectAll: function() { // we'll want an option to supress notification here for(var fid in this.features) { - if (this.features.hasOwnProperty(fid)) { - this.unselect(this.features[fid]); - } + this.unselect(this.features[fid]); } }, @@ -579,9 +573,7 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, { */ setMap: function(map) { for(var i in this.handlers) { - if (this.handlers.hasOwnProperty(i)) { - this.handlers[i].setMap(map); - } + this.handlers[i].setMap(map); } OpenLayers.Control.prototype.setMap.apply(this, arguments); }, diff --git a/lib/OpenLayers/Control/NavigationHistory.js b/lib/OpenLayers/Control/NavigationHistory.js index 4fe47a629e..eb46946e73 100644 --- a/lib/OpenLayers/Control/NavigationHistory.js +++ b/lib/OpenLayers/Control/NavigationHistory.js @@ -193,9 +193,7 @@ OpenLayers.Control.NavigationHistory = OpenLayers.Class(OpenLayers.Control, { this.next.destroy(); this.deactivate(); for(var prop in this) { - if (this.hasOwnProperty(prop)) { - this[prop] = null; - } + this[prop] = null; } }, @@ -336,27 +334,25 @@ OpenLayers.Control.NavigationHistory = OpenLayers.Class(OpenLayers.Control, { setListeners: function() { this.listeners = {}; for(var type in this.registry) { - if (this.registry.hasOwnProperty(type)) { - this.listeners[type] = OpenLayers.Function.bind(function() { - if(!this.restoring) { - var state = this.registry[type].apply(this, arguments); - this.previousStack.unshift(state); - if(this.previousStack.length > 1) { - this.onPreviousChange( - this.previousStack[1], this.previousStack.length - 1 - ); - } - if(this.previousStack.length > (this.limit + 1)) { - this.previousStack.pop(); - } - if(this.nextStack.length > 0) { - this.nextStack = []; - this.onNextChange(null, 0); - } + this.listeners[type] = OpenLayers.Function.bind(function() { + if(!this.restoring) { + var state = this.registry[type].apply(this, arguments); + this.previousStack.unshift(state); + if(this.previousStack.length > 1) { + this.onPreviousChange( + this.previousStack[1], this.previousStack.length - 1 + ); } - return true; - }, this); - } + if(this.previousStack.length > (this.limit + 1)) { + this.previousStack.pop(); + } + if(this.nextStack.length > 0) { + this.nextStack = []; + this.onNextChange(null, 0); + } + } + return true; + }, this); } }, @@ -375,9 +371,7 @@ OpenLayers.Control.NavigationHistory = OpenLayers.Class(OpenLayers.Control, { this.setListeners(); } for(var type in this.listeners) { - if (this.listeners.hasOwnProperty(type)) { - this.map.events.register(type, this, this.listeners[type]); - } + this.map.events.register(type, this, this.listeners[type]); } activated = true; if(this.previousStack.length == 0) { @@ -411,11 +405,9 @@ OpenLayers.Control.NavigationHistory = OpenLayers.Class(OpenLayers.Control, { if(this.map) { if(OpenLayers.Control.prototype.deactivate.apply(this)) { for(var type in this.listeners) { - if (this.listeners.hasOwnProperty(type)) { - this.map.events.unregister( - type, this, this.listeners[type] - ); - } + this.map.events.unregister( + type, this, this.listeners[type] + ); } if(this.clearOnDeactivate) { this.clear(); diff --git a/lib/OpenLayers/Control/SLDSelect.js b/lib/OpenLayers/Control/SLDSelect.js index 50ac906afd..52f0798ae9 100644 --- a/lib/OpenLayers/Control/SLDSelect.js +++ b/lib/OpenLayers/Control/SLDSelect.js @@ -168,16 +168,11 @@ OpenLayers.Control.SLDSelect = OpenLayers.Class(OpenLayers.Control, { * Take care of things that are not handled in superclass. */ destroy: function() { - var key; - for (key in this.layerCache) { - if (this.layerCache.hasOwnProperty(key)) { - delete this.layerCache[key]; - } + for (var key in this.layerCache) { + delete this.layerCache[key]; } - for (key in this.wfsCache) { - if (this.wfsCache.hasOwnProperty(key)) { - delete this.wfsCache[key]; - } + for (var key in this.wfsCache) { + delete this.wfsCache[key]; } OpenLayers.Control.prototype.destroy.apply(this, arguments); }, diff --git a/lib/OpenLayers/Control/WMSGetFeatureInfo.js b/lib/OpenLayers/Control/WMSGetFeatureInfo.js index 67555f1038..9348a9d542 100644 --- a/lib/OpenLayers/Control/WMSGetFeatureInfo.js +++ b/lib/OpenLayers/Control/WMSGetFeatureInfo.js @@ -456,12 +456,10 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, { } var layers; for (var url in services) { - if (services.hasOwnProperty(url)) { - layers = services[url]; - var wmsOptions = this.buildWMSOptions(url, layers, - clickPosition, layers[0].params.FORMAT); - OpenLayers.Request.GET(wmsOptions); - } + layers = services[url]; + var wmsOptions = this.buildWMSOptions(url, layers, + clickPosition, layers[0].params.FORMAT); + OpenLayers.Request.GET(wmsOptions); } } }, diff --git a/lib/OpenLayers/Format/GML/Base.js b/lib/OpenLayers/Format/GML/Base.js index 9abbf5aa7a..0eceadaed6 100644 --- a/lib/OpenLayers/Format/GML/Base.js +++ b/lib/OpenLayers/Format/GML/Base.js @@ -564,14 +564,12 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, { this.writeNode("feature:_geometry", feature.geometry, node); } for(var name in feature.attributes) { - if (feature.attributes.hasOwnProperty(name)) { - var value = feature.attributes[name]; - if(value != null) { - this.writeNode( - "feature:_attribute", - {name: name, value: value}, node - ); - } + var value = feature.attributes[name]; + if(value != null) { + this.writeNode( + "feature:_attribute", + {name: name, value: value}, node + ); } } return node; diff --git a/lib/OpenLayers/Format/GeoRSS.js b/lib/OpenLayers/Format/GeoRSS.js index 0fc1790f6d..a9e117b2ec 100644 --- a/lib/OpenLayers/Format/GeoRSS.js +++ b/lib/OpenLayers/Format/GeoRSS.js @@ -325,17 +325,15 @@ OpenLayers.Format.GeoRSS = OpenLayers.Class(OpenLayers.Format.XML, { featureNode.appendChild(linkNode); } for(var attr in feature.attributes) { - if (feature.attributes.hasOwnProperty(attr)) { - if (attr == "link" || attr == "title" || attr == "description") { continue; } - var attrText = this.createTextNode(feature.attributes[attr]); - var nodename = attr; - if (attr.search(":") != -1) { - nodename = attr.split(":")[1]; - } - var attrContainer = this.createElementNS(this.featureNS, "feature:"+nodename); - attrContainer.appendChild(attrText); - featureNode.appendChild(attrContainer); - } + if (attr == "link" || attr == "title" || attr == "description") { continue; } + var attrText = this.createTextNode(feature.attributes[attr]); + var nodename = attr; + if (attr.search(":") != -1) { + nodename = attr.split(":")[1]; + } + var attrContainer = this.createElementNS(this.featureNS, "feature:"+nodename); + attrContainer.appendChild(attrText); + featureNode.appendChild(attrContainer); } featureNode.appendChild(geometryNode); return featureNode; diff --git a/lib/OpenLayers/Format/OSM.js b/lib/OpenLayers/Format/OSM.js index a5de50fc35..48ef45ac91 100644 --- a/lib/OpenLayers/Format/OSM.js +++ b/lib/OpenLayers/Format/OSM.js @@ -140,35 +140,33 @@ OpenLayers.Format.OSM = OpenLayers.Class(OpenLayers.Format.XML, { feat_list[i] = feat; } for (var node_id in nodes) { - if (nodes.hasOwnProperty(node_id)) { - var node = nodes[node_id]; - if (!node.used || this.checkTags) { - var tags = null; + var node = nodes[node_id]; + if (!node.used || this.checkTags) { + var tags = null; - if (this.checkTags) { - var result = this.getTags(node.node, true); - if (node.used && !result[1]) { - continue; - } - tags = result[0]; - } else { - tags = this.getTags(node.node); - } + if (this.checkTags) { + var result = this.getTags(node.node, true); + if (node.used && !result[1]) { + continue; + } + tags = result[0]; + } else { + tags = this.getTags(node.node); + } - var feat = new OpenLayers.Feature.Vector( - new OpenLayers.Geometry.Point(node['lon'], node['lat']), - tags); - if (this.internalProjection && this.externalProjection) { - feat.geometry.transform(this.externalProjection, - this.internalProjection); - } - feat.osm_id = parseInt(node_id); - feat.fid = "node." + feat.osm_id; - feat_list.push(feat); - } - // Memory cleanup - node.node = null; - } + var feat = new OpenLayers.Feature.Vector( + new OpenLayers.Geometry.Point(node['lon'], node['lat']), + tags); + if (this.internalProjection && this.externalProjection) { + feat.geometry.transform(this.externalProjection, + this.internalProjection); + } + feat.osm_id = parseInt(node_id); + feat.fid = "node." + feat.osm_id; + feat_list.push(feat); + } + // Memory cleanup + node.node = null; } return feat_list; }, @@ -275,11 +273,9 @@ OpenLayers.Format.OSM = OpenLayers.Class(OpenLayers.Format.XML, { } if (this.checkTags) { for(var key in way.tags) { - if (way.tags.hasOwnProperty(key)) { - if (this.areaTags[key]) { - poly_tags = true; - break; - } + if (this.areaTags[key]) { + poly_tags = true; + break; } } } @@ -434,12 +430,10 @@ OpenLayers.Format.OSM = OpenLayers.Class(OpenLayers.Format.XML, { */ serializeTags: function(feature, node) { for (var key in feature.attributes) { - if (feature.attributes.hasOwnProperty(key)) { - var tag = this.createElementNS(null, "tag"); - tag.setAttribute("k", key); - tag.setAttribute("v", feature.attributes[key]); - node.appendChild(tag); - } + var tag = this.createElementNS(null, "tag"); + tag.setAttribute("k", key); + tag.setAttribute("v", feature.attributes[key]); + node.appendChild(tag); } }, diff --git a/lib/OpenLayers/Format/SLD/v1.js b/lib/OpenLayers/Format/SLD/v1.js index 2a1c2e33af..cd32810be9 100644 --- a/lib/OpenLayers/Format/SLD/v1.js +++ b/lib/OpenLayers/Format/SLD/v1.js @@ -541,11 +541,9 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { getCssProperty: function(sym) { var css = null; for(var prop in this.cssMap) { - if (this.cssMap.hasOwnProperty(prop)) { - if(this.cssMap[prop] == sym) { - css = prop; - break; - } + if(this.cssMap[prop] == sym) { + css = prop; + break; } } return css; @@ -567,14 +565,12 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { getGraphicFormat: function(href) { var format, regex; for(var key in this.graphicFormats) { - if (this.graphicFormats.hasOwnProperty(key)) { - if(this.graphicFormats[key].test(href)) { - format = key; - break; - } + if(this.graphicFormats[key].test(href)) { + format = key; + break; } } - return format || this.defaultGraphicFormat; + return format || this.defautlGraphicFormat; }, /** @@ -680,9 +676,7 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { } } else { for(var name in sld.namedLayers) { - if (sld.namedLayers.hasOwnProperty(name)) { - this.writeNode("NamedLayer", sld.namedLayers[name], root); - } + this.writeNode("NamedLayer", sld.namedLayers[name], root); } } return root; @@ -775,13 +769,11 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { ruleMap[zIndex].symbolizers.push(symbolizer.clone()); } for (zIndex in ruleMap) { - if (ruleMap.hasOwnProperty(zIndex)) { - if (!(zIndex in rulesByZ)) { - zValues.push(zIndex); - rulesByZ[zIndex] = []; - } - rulesByZ[zIndex].push(ruleMap[zIndex]); + if (!(zIndex in rulesByZ)) { + zValues.push(zIndex); + rulesByZ[zIndex] = []; } + rulesByZ[zIndex].push(ruleMap[zIndex]); } } else { // no symbolizers in rule diff --git a/lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js b/lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js index 784e42b592..bee661311b 100644 --- a/lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js +++ b/lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js @@ -128,12 +128,10 @@ OpenLayers.Format.SLD.v1_0_0_GeoServer = OpenLayers.Class( var options = symbolizer.vendorOptions; if (options) { for (var key in symbolizer.vendorOptions) { - if (symbolizer.vendorOptions.hasOwnProperty(key)) { - this.writeNode("VendorOption", { - name: key, - value: symbolizer.vendorOptions[key] - }, node); - } + this.writeNode("VendorOption", { + name: key, + value: symbolizer.vendorOptions[key] + }, node); } } return node; diff --git a/lib/OpenLayers/Format/SOSGetObservation.js b/lib/OpenLayers/Format/SOSGetObservation.js index feb1e35a49..a7f2c1725f 100644 --- a/lib/OpenLayers/Format/SOSGetObservation.js +++ b/lib/OpenLayers/Format/SOSGetObservation.js @@ -210,14 +210,10 @@ OpenLayers.Format.SOSGetObservation = OpenLayers.Class(OpenLayers.Format.XML, { this.writeNode("eventTime", options, node); } for (var procedure in options.procedures) { - if (options.procedures.hasOwnProperty(procedure)) { - this.writeNode("procedure", options.procedures[procedure], node); - } + this.writeNode("procedure", options.procedures[procedure], node); } for (var observedProperty in options.observedProperties) { - if (options.observedProperties.hasOwnProperty(observedProperty)) { - this.writeNode("observedProperty", options.observedProperties[observedProperty], node); - } + this.writeNode("observedProperty", options.observedProperties[observedProperty], node); } if (options.foi) { this.writeNode("featureOfInterest", options.foi, node); diff --git a/lib/OpenLayers/Format/WFS.js b/lib/OpenLayers/Format/WFS.js index 0d69566ad6..860df0aa5f 100644 --- a/lib/OpenLayers/Format/WFS.js +++ b/lib/OpenLayers/Format/WFS.js @@ -104,17 +104,15 @@ OpenLayers.Format.WFS = OpenLayers.Class(OpenLayers.Format.GML, { var featureContainer = this.createElementNS(this.featureNS, "feature:" + this.featureName); featureContainer.appendChild(geomContainer); for(var attr in feature.attributes) { - if (feature.attributes.hasOwnProperty(attr)) { - var attrText = this.createTextNode(feature.attributes[attr]); - var nodename = attr; - if (attr.search(":") != -1) { - nodename = attr.split(":")[1]; - } - var attrContainer = this.createElementNS(this.featureNS, "feature:" + nodename); - attrContainer.appendChild(attrText); - featureContainer.appendChild(attrContainer); - } - } + var attrText = this.createTextNode(feature.attributes[attr]); + var nodename = attr; + if (attr.search(":") != -1) { + nodename = attr.split(":")[1]; + } + var attrContainer = this.createElementNS(this.featureNS, "feature:" + nodename); + attrContainer.appendChild(attrText); + featureContainer.appendChild(attrContainer); + } return featureContainer; }, @@ -168,16 +166,14 @@ OpenLayers.Format.WFS = OpenLayers.Class(OpenLayers.Format.GML, { // add in attributes for(var propName in feature.attributes) { - if (feature.attributes.hasOwnProperty(propName)) { - propertyNode = this.createElementNS(this.wfsns, 'wfs:Property'); - nameNode = this.createElementNS(this.wfsns, 'wfs:Name'); - nameNode.appendChild(this.createTextNode(propName)); - propertyNode.appendChild(nameNode); - valueNode = this.createElementNS(this.wfsns, 'wfs:Value'); - valueNode.appendChild(this.createTextNode(feature.attributes[propName])); - propertyNode.appendChild(valueNode); - updateNode.appendChild(propertyNode); - } + propertyNode = this.createElementNS(this.wfsns, 'wfs:Property'); + nameNode = this.createElementNS(this.wfsns, 'wfs:Name'); + nameNode.appendChild(this.createTextNode(propName)); + propertyNode.appendChild(nameNode); + valueNode = this.createElementNS(this.wfsns, 'wfs:Value'); + valueNode.appendChild(this.createTextNode(feature.attributes[propName])); + propertyNode.appendChild(valueNode); + updateNode.appendChild(propertyNode); } diff --git a/lib/OpenLayers/Format/WFST/v1.js b/lib/OpenLayers/Format/WFST/v1.js index 5341fd17a7..e3bf963afc 100644 --- a/lib/OpenLayers/Format/WFST/v1.js +++ b/lib/OpenLayers/Format/WFST/v1.js @@ -332,14 +332,12 @@ OpenLayers.Format.WFST.v1 = OpenLayers.Class(OpenLayers.Format.XML, { // add in attributes for(var key in feature.attributes) { - if (feature.attributes.hasOwnProperty(key)) { - if(feature.attributes[key] !== undefined && - (!modified || !modified.attributes || - (modified.attributes && modified.attributes[key] !== undefined))) { - this.writeNode( - "Property", {name: key, value: feature.attributes[key]}, node - ); - } + if(feature.attributes[key] !== undefined && + (!modified || !modified.attributes || + (modified.attributes && modified.attributes[key] !== undefined))) { + this.writeNode( + "Property", {name: key, value: feature.attributes[key]}, node + ); } } @@ -412,11 +410,9 @@ OpenLayers.Format.WFST.v1 = OpenLayers.Class(OpenLayers.Format.XML, { var parts = []; var uri; for(var key in schemaLocations) { - if (schemaLocations.hasOwnProperty(key)) { - uri = this.namespaces[key]; - if(uri) { - parts.push(uri + " " + schemaLocations[key]); - } + uri = this.namespaces[key]; + if(uri) { + parts.push(uri + " " + schemaLocations[key]); } } var value = parts.join(" ") || undefined; diff --git a/lib/OpenLayers/Format/WMC/v1.js b/lib/OpenLayers/Format/WMC/v1.js index 46e1947cbc..e6eed09b44 100644 --- a/lib/OpenLayers/Format/WMC/v1.js +++ b/lib/OpenLayers/Format/WMC/v1.js @@ -48,10 +48,8 @@ OpenLayers.Format.WMC.v1 = OpenLayers.Class(OpenLayers.Format.XML, { prefix = this.namespaces[this.defaultPrefix]; } else { for(prefix in this.namespaces) { - if (this.namespaces.hasOwnProperty(prefix)) { - if(this.namespaces[prefix] == uri) { - break; - } + if(this.namespaces[prefix] == uri) { + break; } } } @@ -676,14 +674,12 @@ OpenLayers.Format.WMC.v1 = OpenLayers.Class(OpenLayers.Format.XML, { setAttributes: function(node, obj) { var value; for(var name in obj) { - if (obj.hasOwnProperty(name)) { - value = obj[name].toString(); - if(value.match(/[A-Z]/)) { - // safari lowercases attributes with setAttribute - this.setAttributeNS(node, null, name, value); - } else { - node.setAttribute(name, value); - } + value = obj[name].toString(); + if(value.match(/[A-Z]/)) { + // safari lowercases attributes with setAttribute + this.setAttributeNS(node, null, name, value); + } else { + node.setAttribute(name, value); } } }, @@ -1095,29 +1091,25 @@ OpenLayers.Format.WMC.v1 = OpenLayers.Class(OpenLayers.Format.XML, { userValue: true }; for (var dim in context.dimensions) { - if (context.dimensions.hasOwnProperty(dim)) { - var attributes = {}; - var dimension = context.dimensions[dim]; - for (var name in dimension) { - if (dimension.hasOwnProperty(name)) { - if (typeof dimension[name] == "boolean") { - attributes[name] = Number(dimension[name]); - } else { - attributes[name] = dimension[name]; - } - } - } - var values = ""; - if (attributes.values) { - values = attributes.values.join(","); - delete attributes.values; + var attributes = {}; + var dimension = context.dimensions[dim]; + for (var name in dimension) { + if (typeof dimension[name] == "boolean") { + attributes[name] = Number(dimension[name]); + } else { + attributes[name] = dimension[name]; } + } + var values = ""; + if (attributes.values) { + values = attributes.values.join(","); + delete attributes.values; + } - node.appendChild(this.createElementDefaultNS( - "Dimension", values, attributes - )); - } - } + node.appendChild(this.createElementDefaultNS( + "Dimension", values, attributes + )); + } return node; }, diff --git a/lib/OpenLayers/Format/WMC/v1_1_0.js b/lib/OpenLayers/Format/WMC/v1_1_0.js index ceed7f5fd2..16caf0ece4 100644 --- a/lib/OpenLayers/Format/WMC/v1_1_0.js +++ b/lib/OpenLayers/Format/WMC/v1_1_0.js @@ -122,9 +122,7 @@ OpenLayers.Format.WMC.v1_1_0 = OpenLayers.Class( // optional SRS element(s) if (context.srs) { for(var name in context.srs) { - if (context.srs.hasOwnProperty(name)) { - node.appendChild(this.createElementDefaultNS("SRS", name)); - } + node.appendChild(this.createElementDefaultNS("SRS", name)); } } diff --git a/lib/OpenLayers/Format/WMTSCapabilities.js b/lib/OpenLayers/Format/WMTSCapabilities.js index b142072092..d69e944c5f 100644 --- a/lib/OpenLayers/Format/WMTSCapabilities.js +++ b/lib/OpenLayers/Format/WMTSCapabilities.js @@ -84,10 +84,8 @@ OpenLayers.Format.WMTSCapabilities = OpenLayers.Class(OpenLayers.Format.XML.Vers matrixSet: true }; for (var prop in required) { - if (required.hasOwnProperty(prop)) { - if (!(prop in config)) { - throw new Error("Missing property '" + prop + "' in layer configuration."); - } + if (!(prop in config)) { + throw new Error("Missing property '" + prop + "' in layer configuration."); } } diff --git a/lib/OpenLayers/Format/XML.js b/lib/OpenLayers/Format/XML.js index 3d8be16ed5..e5cc118891 100644 --- a/lib/OpenLayers/Format/XML.js +++ b/lib/OpenLayers/Format/XML.js @@ -89,9 +89,7 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, { this.namespaces = OpenLayers.Util.extend({}, this.namespaces); this.namespaceAlias = {}; for(var alias in this.namespaces) { - if (this.namespaces.hasOwnProperty(alias)) { - this.namespaceAlias[this.namespaces[alias]] = alias; - } + this.namespaceAlias[this.namespaces[alias]] = alias; } }, @@ -560,13 +558,11 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, { setAttributes: function(node, obj) { var value, uri; for(var name in obj) { - if (obj.hasOwnProperty(name)) { - if(obj[name] != null && obj[name].toString) { - value = obj[name].toString(); - // check for qualified attribute name ("prefix:local") - uri = this.namespaces[name.substring(0, name.indexOf(":"))] || null; - this.setAttributeNS(node, uri, name, value); - } + if(obj[name] != null && obj[name].toString) { + value = obj[name].toString(); + // check for qualified attribute name ("prefix:local") + uri = this.namespaces[name.substring(0, name.indexOf(":"))] || null; + this.setAttributeNS(node, uri, name, value); } } }, diff --git a/lib/OpenLayers/Layer.js b/lib/OpenLayers/Layer.js index 76f6b5d6b7..788b6e7633 100644 --- a/lib/OpenLayers/Layer.js +++ b/lib/OpenLayers/Layer.js @@ -423,9 +423,7 @@ OpenLayers.Layer = OpenLayers.Class({ getOptions: function() { var options = {}; for(var o in this.options) { - if (this.options.hasOwnProperty(o)) { - options[o] = this[o]; - } + options[o] = this[o]; } return options; }, diff --git a/lib/OpenLayers/Layer/HTTPRequest.js b/lib/OpenLayers/Layer/HTTPRequest.js index 6cbc83dc3d..d1e9bf2219 100644 --- a/lib/OpenLayers/Layer/HTTPRequest.js +++ b/lib/OpenLayers/Layer/HTTPRequest.js @@ -218,10 +218,8 @@ OpenLayers.Layer.HTTPRequest = OpenLayers.Class(OpenLayers.Layer, { var urlParams = OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(url)); for(var key in allParams) { - if (allParams.hasOwnProperty(key)) { - if(key.toUpperCase() in urlParams) { - delete allParams[key]; - } + if(key.toUpperCase() in urlParams) { + delete allParams[key]; } } paramsString = OpenLayers.Util.getParameterString(allParams); diff --git a/lib/OpenLayers/Layer/MapGuide.js b/lib/OpenLayers/Layer/MapGuide.js index 4285fd6094..680b8472c2 100644 --- a/lib/OpenLayers/Layer/MapGuide.js +++ b/lib/OpenLayers/Layer/MapGuide.js @@ -346,10 +346,8 @@ OpenLayers.Layer.MapGuide = OpenLayers.Class(OpenLayers.Layer.Grid, { var urlParams = OpenLayers.Util.upperCaseObject( OpenLayers.Util.getParameters(url)); for(var key in allParams) { - if (allParams.hasOwnProperty(key)) { - if(key.toUpperCase() in urlParams) { - delete allParams[key]; - } + if(key.toUpperCase() in urlParams) { + delete allParams[key]; } } var paramsString = OpenLayers.Util.getParameterString(allParams); diff --git a/lib/OpenLayers/Layer/MapServer.js b/lib/OpenLayers/Layer/MapServer.js index 2151961713..61e9930ab9 100644 --- a/lib/OpenLayers/Layer/MapServer.js +++ b/lib/OpenLayers/Layer/MapServer.js @@ -142,10 +142,8 @@ OpenLayers.Layer.MapServer = OpenLayers.Class(OpenLayers.Layer.Grid, { var urlParams = OpenLayers.Util.upperCaseObject( OpenLayers.Util.getParameters(url)); for(var key in allParams) { - if (allParams.hasOwnProperty(key)) { - if(key.toUpperCase() in urlParams) { - delete allParams[key]; - } + if(key.toUpperCase() in urlParams) { + delete allParams[key]; } } paramsString = OpenLayers.Util.getParameterString(allParams); diff --git a/lib/OpenLayers/Layer/Vector.js b/lib/OpenLayers/Layer/Vector.js index 0e771b0017..2857a82d7b 100644 --- a/lib/OpenLayers/Layer/Vector.js +++ b/lib/OpenLayers/Layer/Vector.js @@ -509,10 +509,8 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, { if(!zoomChanged && coordSysUnchanged) { for(var i in this.unrenderedFeatures) { - if (this.unrenderedFeatures.hasOwnProperty(i)) { - var feature = this.unrenderedFeatures[i]; - this.drawFeature(feature); - } + var feature = this.unrenderedFeatures[i]; + this.drawFeature(feature); } } } @@ -1025,4 +1023,4 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, { }, CLASS_NAME: "OpenLayers.Layer.Vector" -}); +}); \ No newline at end of file diff --git a/lib/OpenLayers/Layer/WMTS.js b/lib/OpenLayers/Layer/WMTS.js index 8673502f6f..c82beb4d18 100644 --- a/lib/OpenLayers/Layer/WMTS.js +++ b/lib/OpenLayers/Layer/WMTS.js @@ -229,10 +229,8 @@ OpenLayers.Layer.WMTS = OpenLayers.Class(OpenLayers.Layer.Grid, { matrixSet: true }; for (var prop in required) { - if (required.hasOwnProperty(prop)) { - if (!(prop in config)) { - throw new Error("Missing property '" + prop + "' in layer configuration."); - } + if (!(prop in config)) { + throw new Error("Missing property '" + prop + "' in layer configuration."); } } diff --git a/lib/OpenLayers/Protocol/Script.js b/lib/OpenLayers/Protocol/Script.js index a92a0c9360..49e332b7f0 100644 --- a/lib/OpenLayers/Protocol/Script.js +++ b/lib/OpenLayers/Protocol/Script.js @@ -135,7 +135,7 @@ OpenLayers.Protocol.Script = OpenLayers.Class(OpenLayers.Protocol, { }); this.filterToParams = function(filter, params) { return format.write(filter, params); - }; + } } }, @@ -311,9 +311,7 @@ OpenLayers.Protocol.Script = OpenLayers.Class(OpenLayers.Protocol, { this.destroyRequest(response.priv); } else { for (var key in this.pendingRequests) { - if (this.pendingRequests.hasOwnProperty(key)) { - this.destroyRequest(this.pendingRequests[key]); - } + this.destroyRequest(this.pendingRequests[key]); } } }, diff --git a/lib/OpenLayers/Request.js b/lib/OpenLayers/Request.js index f1f51467a2..a5de46fdee 100644 --- a/lib/OpenLayers/Request.js +++ b/lib/OpenLayers/Request.js @@ -181,9 +181,7 @@ OpenLayers.Request = { config.method, url, config.async, config.user, config.password ); for(var header in config.headers) { - if (config.headers.hasOwnProperty(header)) { - request.setRequestHeader(header, config.headers[header]); - } + request.setRequestHeader(header, config.headers[header]); } var events = this.events; diff --git a/lib/OpenLayers/Rule.js b/lib/OpenLayers/Rule.js index 0f7db50ae2..452b3de25f 100644 --- a/lib/OpenLayers/Rule.js +++ b/lib/OpenLayers/Rule.js @@ -128,9 +128,7 @@ OpenLayers.Rule = OpenLayers.Class({ */ destroy: function() { for (var i in this.symbolizer) { - if (this.symbolizer.hasOwnProperty(i)) { - this.symbolizer[i] = null; - } + this.symbolizer[i] = null; } this.symbolizer = null; delete this.symbolizers; @@ -218,14 +216,12 @@ OpenLayers.Rule = OpenLayers.Class({ options.symbolizer = {}; var value, type; for(var key in this.symbolizer) { - if (this.symbolizer.hasOwnProperty(key)) { - value = this.symbolizer[key]; - type = typeof value; - if(type === "object") { - options.symbolizer[key] = OpenLayers.Util.extend({}, value); - } else if(type === "string") { - options.symbolizer[key] = value; - } + value = this.symbolizer[key]; + type = typeof value; + if(type === "object") { + options.symbolizer[key] = OpenLayers.Util.extend({}, value); + } else if(type === "string") { + options.symbolizer[key] = value; } } } @@ -237,4 +233,4 @@ OpenLayers.Rule = OpenLayers.Class({ }, CLASS_NAME: "OpenLayers.Rule" -}); +}); \ No newline at end of file diff --git a/lib/OpenLayers/Style.js b/lib/OpenLayers/Style.js index 891af83181..1af88dfba2 100644 --- a/lib/OpenLayers/Style.js +++ b/lib/OpenLayers/Style.js @@ -273,9 +273,7 @@ OpenLayers.Style = OpenLayers.Class({ OpenLayers.Util.extend(context, this.context); for (var i in this.propertyStyles) { - if (this.propertyStyles.hasOwnProperty(i)) { - style[i] = OpenLayers.Style.createLiteral(style[i], context, feature, i); - } + style[i] = OpenLayers.Style.createLiteral(style[i], context, feature, i); } return style; }, @@ -303,16 +301,14 @@ OpenLayers.Style = OpenLayers.Class({ for (var i=0, len=rules.length; i