From 8f77f9e5111e7c15257783d5b861087ee601ad7b Mon Sep 17 00:00:00 2001 From: ahocevar Date: Thu, 29 Jan 2009 16:01:12 +0000 Subject: [PATCH] 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 --- lib/OpenLayers/Format/XML.js | 8 ++++++-- tests/Format/XML.html | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers/Format/XML.js b/lib/OpenLayers/Format/XML.js index e662e43617..02bbde1c4c 100644 --- a/lib/OpenLayers/Format/XML.js +++ b/lib/OpenLayers/Format/XML.js @@ -493,8 +493,12 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, { if(options.attributes) { this.setAttributes(node, options.attributes); } - if(options.value != null) { - node.appendChild(this.createTextNode(options.value)); + var value = options.value; + if(value != null) { + if(typeof value == "boolean") { + value = encodeURIComponent(value); + } + node.appendChild(this.createTextNode(value)); } return node; }, diff --git a/tests/Format/XML.html b/tests/Format/XML.html index b3bdd9385d..24a3952a11 100644 --- a/tests/Format/XML.html +++ b/tests/Format/XML.html @@ -595,6 +595,10 @@ description: "value of 0 gets appended as a text node", node: format.createElementNSPlus("foo:bar", {value: 0}), expect: "0" + }, { + description: "value of true gets appended as a text node", + node: format.createElementNSPlus("foo:bar", {value: true}), + expect: "true" }, { description: "value of false gets appended as a text node", node: format.createElementNSPlus("foo:bar", {value: false}),