diff --git a/lib/OpenLayers/Format/GeoRSS.js b/lib/OpenLayers/Format/GeoRSS.js
index 8f15415724..406cf42dec 100644
--- a/lib/OpenLayers/Format/GeoRSS.js
+++ b/lib/OpenLayers/Format/GeoRSS.js
@@ -253,7 +253,7 @@ OpenLayers.Format.GeoRSS = OpenLayers.Class(OpenLayers.Format.XML, {
var eles = this.getElementsByTagNameNS(node, nsuri, name);
if(eles && eles[0] && eles[0].firstChild
&& eles[0].firstChild.nodeValue) {
- value = eles[0].firstChild.nodeValue;
+ value = OpenLayers.Format.XML.prototype.getChildValue(eles[0]);
} else {
value = (def == undefined) ? "" : def;
}
diff --git a/tests/Format/GeoRSS.html b/tests/Format/GeoRSS.html
index 95d3ba99d9..5cea1ae627 100644
--- a/tests/Format/GeoRSS.html
+++ b/tests/Format/GeoRSS.html
@@ -73,6 +73,15 @@
t.xml_eq(out, expected_result, "Output gave expected value");
}
}
+
+ function test_leading_space(t) {
+ t.plan(2);
+
+ var parser = new OpenLayers.Format.GeoRSS();
+ var items = parser.read('-
');
+ t.eq(items.length, 1, "item created");
+ t.eq(items[0].attributes.description, " foo", "description value is ok");
+ }
var shell_start = '\n scribble\n http://featureserver.org/featureserver.cgi/scribble?format=atom\n FeatureServer\n';
var shell_end = '';