Merge pull request #272 from elemoine/revert-hasownproperty
do not generalize use of hasOwnProperty
This commit is contained in:
@@ -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);
|
||||
},
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
},
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user