[OpenLayers-Commits] r11574 - in trunk/openlayers:
lib/OpenLayers/Format tests/Format
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Mon Feb 28 03:10:11 EST 2011
Author: fredj
Date: 2011-02-28 00:10:10 -0800 (Mon, 28 Feb 2011)
New Revision: 11574
Modified:
trunk/openlayers/lib/OpenLayers/Format/GeoRSS.js
trunk/openlayers/tests/Format/GeoRSS.html
Log:
GeoRSS <description> is not properly parsed if multiple children. r=crschmidt (closes #2780)
Modified: trunk/openlayers/lib/OpenLayers/Format/GeoRSS.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Format/GeoRSS.js 2011-02-28 08:05:56 UTC (rev 11573)
+++ trunk/openlayers/lib/OpenLayers/Format/GeoRSS.js 2011-02-28 08:10:10 UTC (rev 11574)
@@ -253,7 +253,7 @@
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;
}
Modified: trunk/openlayers/tests/Format/GeoRSS.html
===================================================================
--- trunk/openlayers/tests/Format/GeoRSS.html 2011-02-28 08:05:56 UTC (rev 11573)
+++ trunk/openlayers/tests/Format/GeoRSS.html 2011-02-28 08:10:10 UTC (rev 11574)
@@ -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('<rss version="2.0" xmlns:georss="http://www.georss.org/georss"><item><description> <![CDATA[foo]]></description></item></rss>');
+ t.eq(items.length, 1, "item created");
+ t.eq(items[0].attributes.description, " foo", "description value is ok");
+ }
var shell_start = '<feed xmlns="http://www.w3.org/2005/Atom" \n xmlns:georss="http://www.georss.org/georss">\n <title>scribble</title>\n <id>http://featureserver.org/featureserver.cgi/scribble?format=atom</id>\n <author><name>FeatureServer</name></author>\n';
var shell_end = '</feed>';
More information about the Commits
mailing list