protect for in loops with hasOwnProperty
This commit is contained in:
@@ -89,7 +89,9 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, {
|
||||
this.namespaces = OpenLayers.Util.extend({}, this.namespaces);
|
||||
this.namespaceAlias = {};
|
||||
for(var alias in this.namespaces) {
|
||||
this.namespaceAlias[this.namespaces[alias]] = alias;
|
||||
if (this.namespaces.hasOwnProperty(alias)) {
|
||||
this.namespaceAlias[this.namespaces[alias]] = alias;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -558,11 +560,13 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, {
|
||||
setAttributes: function(node, obj) {
|
||||
var value, uri;
|
||||
for(var name in obj) {
|
||||
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.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user