diff --git a/lib/OpenLayers/Feature/WFS.js b/lib/OpenLayers/Feature/WFS.js index 9d47380622..f201d20c6b 100644 --- a/lib/OpenLayers/Feature/WFS.js +++ b/lib/OpenLayers/Feature/WFS.js @@ -49,7 +49,7 @@ OpenLayers.Feature.WFS.prototype = //this should be overridden by subclasses // must return an Object with 'id' and 'lonlat' values set var point = xmlNode.getElementsByTagName("Point"); - var text = point[0].textContent; + var text = OpenLayers.Util.getXmlNodeValue(point[0]); var floats = text.split(","); return {lonlat: new OpenLayers.LonLat(parseFloat(floats[0]), diff --git a/lib/OpenLayers/Util.js b/lib/OpenLayers/Util.js index 38c821e8ef..bf202268f9 100644 --- a/lib/OpenLayers/Util.js +++ b/lib/OpenLayers/Util.js @@ -1035,6 +1035,24 @@ OpenLayers.Util.getTagText = function (parent, item, index) { } }; +/** + * @param {XMLNode} node + * + * @returns The text value of the given node, without breaking in firefox or IE + * @type String + */ +OpenLayers.Util.getXmlNodeValue = function(node) { + var val = null; + Try.these( + function() { + val = node.text; + }, + function() { + val = node.textContent; + }); + return val; +}; + /** * @param {Event} evt * @param {HTMLDivElement} div