From 319c8f87ef9deb493d6ad2ae29579fa7e3441fe2 Mon Sep 17 00:00:00 2001 From: crschmidt Date: Tue, 26 Aug 2008 23:11:03 +0000 Subject: [PATCH] Exceptions in Firefox are slow. (The costs of the lovely exception.stack, most likely.) Don't depend on exceptions for parsing XML, then: instead, use an if/else. 3x speed up of WMC parsing in FF. r=ahocevar (Closes #1642) git-svn-id: http://svn.openlayers.org/trunk/openlayers@7870 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Format/XML.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers/Format/XML.js b/lib/OpenLayers/Format/XML.js index 2998d85522..a55f120ff6 100644 --- a/lib/OpenLayers/Format/XML.js +++ b/lib/OpenLayers/Format/XML.js @@ -290,9 +290,9 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, { */ getChildValue: function(node, def) { var value; - try { + if (node && node.firstChild && node.firstChild.nodeValue) { value = node.firstChild.nodeValue; - } catch(e) { + } else { value = (def != undefined) ? def : ""; } return value;