Revert "protect for in loops with hasOwnProperty"

This reverts commit e3cc96dbfb.
This commit is contained in:
Éric Lemoine
2012-03-03 22:35:39 +01:00
parent 161b54b6f1
commit 9a116b21b9
31 changed files with 267 additions and 386 deletions
+23 -31
View File
@@ -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();