suggestion from #138

git-svn-id: http://svn.openlayers.org/trunk/openlayers@1186 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-08-10 05:59:17 +00:00
parent ef4c2b07e5
commit 375d968278
2 changed files with 19 additions and 1 deletions

View File

@@ -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]),

View File

@@ -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