protect for in loops with hasOwnProperty
This commit is contained in:
@@ -104,15 +104,17 @@ OpenLayers.Format.WFS = OpenLayers.Class(OpenLayers.Format.GML, {
|
||||
var featureContainer = this.createElementNS(this.featureNS, "feature:" + this.featureName);
|
||||
featureContainer.appendChild(geomContainer);
|
||||
for(var attr in feature.attributes) {
|
||||
var attrText = this.createTextNode(feature.attributes[attr]);
|
||||
var nodename = attr;
|
||||
if (attr.search(":") != -1) {
|
||||
nodename = attr.split(":")[1];
|
||||
}
|
||||
var attrContainer = this.createElementNS(this.featureNS, "feature:" + nodename);
|
||||
attrContainer.appendChild(attrText);
|
||||
featureContainer.appendChild(attrContainer);
|
||||
}
|
||||
if (feature.attributes.hasOwnProperty(attr)) {
|
||||
var attrText = this.createTextNode(feature.attributes[attr]);
|
||||
var nodename = attr;
|
||||
if (attr.search(":") != -1) {
|
||||
nodename = attr.split(":")[1];
|
||||
}
|
||||
var attrContainer = this.createElementNS(this.featureNS, "feature:" + nodename);
|
||||
attrContainer.appendChild(attrText);
|
||||
featureContainer.appendChild(attrContainer);
|
||||
}
|
||||
}
|
||||
return featureContainer;
|
||||
},
|
||||
|
||||
@@ -166,14 +168,16 @@ OpenLayers.Format.WFS = OpenLayers.Class(OpenLayers.Format.GML, {
|
||||
|
||||
// add in attributes
|
||||
for(var propName in feature.attributes) {
|
||||
propertyNode = this.createElementNS(this.wfsns, 'wfs:Property');
|
||||
nameNode = this.createElementNS(this.wfsns, 'wfs:Name');
|
||||
nameNode.appendChild(this.createTextNode(propName));
|
||||
propertyNode.appendChild(nameNode);
|
||||
valueNode = this.createElementNS(this.wfsns, 'wfs:Value');
|
||||
valueNode.appendChild(this.createTextNode(feature.attributes[propName]));
|
||||
propertyNode.appendChild(valueNode);
|
||||
updateNode.appendChild(propertyNode);
|
||||
if (feature.attributes.hasOwnProperty(propName)) {
|
||||
propertyNode = this.createElementNS(this.wfsns, 'wfs:Property');
|
||||
nameNode = this.createElementNS(this.wfsns, 'wfs:Name');
|
||||
nameNode.appendChild(this.createTextNode(propName));
|
||||
propertyNode.appendChild(nameNode);
|
||||
valueNode = this.createElementNS(this.wfsns, 'wfs:Value');
|
||||
valueNode.appendChild(this.createTextNode(feature.attributes[propName]));
|
||||
propertyNode.appendChild(valueNode);
|
||||
updateNode.appendChild(propertyNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user