protect for in loops with hasOwnProperty

This commit is contained in:
Bart van den Eijnden
2012-02-29 18:43:55 +01:00
parent d7a3ecac08
commit e3cc96dbfb
31 changed files with 385 additions and 266 deletions

View File

@@ -128,7 +128,9 @@ OpenLayers.Rule = OpenLayers.Class({
*/
destroy: function() {
for (var i in this.symbolizer) {
this.symbolizer[i] = null;
if (this.symbolizer.hasOwnProperty(i)) {
this.symbolizer[i] = null;
}
}
this.symbolizer = null;
delete this.symbolizers;
@@ -216,12 +218,14 @@ OpenLayers.Rule = OpenLayers.Class({
options.symbolizer = {};
var value, type;
for(var key in this.symbolizer) {
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;
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;
}
}
}
}
@@ -233,4 +237,4 @@ OpenLayers.Rule = OpenLayers.Class({
},
CLASS_NAME: "OpenLayers.Rule"
});
});