protect for in loops with hasOwnProperty
This commit is contained in:
@@ -273,7 +273,9 @@ OpenLayers.Style = OpenLayers.Class({
|
||||
OpenLayers.Util.extend(context, this.context);
|
||||
|
||||
for (var i in this.propertyStyles) {
|
||||
style[i] = OpenLayers.Style.createLiteral(style[i], context, feature, i);
|
||||
if (this.propertyStyles.hasOwnProperty(i)) {
|
||||
style[i] = OpenLayers.Style.createLiteral(style[i], context, feature, i);
|
||||
}
|
||||
}
|
||||
return style;
|
||||
},
|
||||
@@ -301,14 +303,16 @@ OpenLayers.Style = OpenLayers.Class({
|
||||
for (var i=0, len=rules.length; i<len; i++) {
|
||||
symbolizer = rules[i].symbolizer;
|
||||
for (var key in symbolizer) {
|
||||
value = symbolizer[key];
|
||||
if (typeof value == "object") {
|
||||
// symbolizer key is "Point", "Line" or "Polygon"
|
||||
this.addPropertyStyles(propertyStyles, value);
|
||||
} else {
|
||||
// symbolizer is a hash of style properties
|
||||
this.addPropertyStyles(propertyStyles, symbolizer);
|
||||
break;
|
||||
if (symbolizer.hasOwnProperty(key)) {
|
||||
value = symbolizer[key];
|
||||
if (typeof value == "object") {
|
||||
// symbolizer key is "Point", "Line" or "Polygon"
|
||||
this.addPropertyStyles(propertyStyles, value);
|
||||
} else {
|
||||
// symbolizer is a hash of style properties
|
||||
this.addPropertyStyles(propertyStyles, symbolizer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -329,10 +333,12 @@ OpenLayers.Style = OpenLayers.Class({
|
||||
addPropertyStyles: function(propertyStyles, symbolizer) {
|
||||
var property;
|
||||
for (var key in symbolizer) {
|
||||
property = symbolizer[key];
|
||||
if (typeof property == "string" &&
|
||||
property.match(/\$\{\w+\}/)) {
|
||||
propertyStyles[key] = true;
|
||||
if (symbolizer.hasOwnProperty(key)) {
|
||||
property = symbolizer[key];
|
||||
if (typeof property == "string" &&
|
||||
property.match(/\$\{\w+\}/)) {
|
||||
propertyStyles[key] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return propertyStyles;
|
||||
|
||||
Reference in New Issue
Block a user