boolean values of xml nodes need special treatment in IE. r=crschmidt (closes #1883)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@8779 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -493,8 +493,12 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, {
|
|||||||
if(options.attributes) {
|
if(options.attributes) {
|
||||||
this.setAttributes(node, options.attributes);
|
this.setAttributes(node, options.attributes);
|
||||||
}
|
}
|
||||||
if(options.value != null) {
|
var value = options.value;
|
||||||
node.appendChild(this.createTextNode(options.value));
|
if(value != null) {
|
||||||
|
if(typeof value == "boolean") {
|
||||||
|
value = encodeURIComponent(value);
|
||||||
|
}
|
||||||
|
node.appendChild(this.createTextNode(value));
|
||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -595,6 +595,10 @@
|
|||||||
description: "value of 0 gets appended as a text node",
|
description: "value of 0 gets appended as a text node",
|
||||||
node: format.createElementNSPlus("foo:bar", {value: 0}),
|
node: format.createElementNSPlus("foo:bar", {value: 0}),
|
||||||
expect: "<foo:bar xmlns:foo='http://example.com/foo'>0</foo:bar>"
|
expect: "<foo:bar xmlns:foo='http://example.com/foo'>0</foo:bar>"
|
||||||
|
}, {
|
||||||
|
description: "value of true gets appended as a text node",
|
||||||
|
node: format.createElementNSPlus("foo:bar", {value: true}),
|
||||||
|
expect: "<foo:bar xmlns:foo='http://example.com/foo'>true</foo:bar>"
|
||||||
}, {
|
}, {
|
||||||
description: "value of false gets appended as a text node",
|
description: "value of false gets appended as a text node",
|
||||||
node: format.createElementNSPlus("foo:bar", {value: false}),
|
node: format.createElementNSPlus("foo:bar", {value: false}),
|
||||||
|
|||||||
Reference in New Issue
Block a user