modified checks for Format.WFST should use not equal to undefined instead of truthy to deal properly with initial null values, r=ahocevar (closes #3436)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@12188 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
bartvde
2011-07-25 14:01:00 +00:00
parent 110acd3f84
commit 8abdd4f016
2 changed files with 15 additions and 7 deletions
+6 -6
View File
@@ -183,12 +183,12 @@ OpenLayers.Format.WFST.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
* transaction:
* - *modified* is not set at all: The geometry and all attributes will be
* included.
* - *modified.geometry* is truthy: The geometry will be
* - *modified.geometry* is set (null or a geometry): The geometry will be
* included. If *modified.attributes* is not set, all attributes will
* be included.
* - *modified.attributes* is set: Only the attributes with a truthy value
* in *modified.attributes* will be included. If *modified.geometry*
* is not set, the geometry will not be included.
* - *modified.attributes* is set: Only the attributes set (i.e. to null or
* a value) in *modified.attributes* will be included.
* If *modified.geometry* is not set, the geometry will not be included.
*
* Valid options include:
* - *multi* {Boolean} If set to true, geometries will be casted to
@@ -323,7 +323,7 @@ OpenLayers.Format.WFST.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
// add in geometry
var modified = feature.modified;
if (this.geometryName !== null && (!modified || modified.geometry)) {
if (this.geometryName !== null && (!modified || modified.geometry !== undefined)) {
this.srsName = this.getSrsName(feature);
this.writeNode(
"Property", {name: this.geometryName, value: feature.geometry}, node
@@ -334,7 +334,7 @@ OpenLayers.Format.WFST.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
for(var key in feature.attributes) {
if(feature.attributes[key] !== undefined &&
(!modified || !modified.attributes ||
(modified.attributes && modified.attributes[key]))) {
(modified.attributes && modified.attributes[key] !== undefined))) {
this.writeNode(
"Property", {name: key, value: feature.attributes[key]}, node
);