From f12e598b590d939d25b22f6b9d7aeb095216c5e5 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Mon, 13 Feb 2012 15:42:34 +0100 Subject: [PATCH] [FIX] QWeb2: Array-like character access in String is not supported in IE<8 bzr revid: fme@openerp.com-20120213144234-dtdw5e8ho4x85frj --- addons/web/static/lib/qweb/qweb2.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/web/static/lib/qweb/qweb2.js b/addons/web/static/lib/qweb/qweb2.js index 9845889a0b7..d4f7781e88b 100644 --- a/addons/web/static/lib/qweb/qweb2.js +++ b/addons/web/static/lib/qweb/qweb2.js @@ -241,8 +241,8 @@ QWeb2.Engine = (function() { return true; }, load_xml : function(s) { - s = s.replace(/^\s*|\s*$/g, ''); - if (this.tools.trim(s)[0] === '<') { + s = this.tools.trim(s); + if (s.charAt(0) === '<') { return this.load_xml_string(s); } else { var req = this.get_xhr(); @@ -256,6 +256,9 @@ QWeb2.Engine = (function() { req.send(null); var xDoc = req.responseXML; if (xDoc) { + if (!xDoc.documentElement) { + throw new Error("QWeb2: This xml document has no root document : " + xDoc.responseText); + } if (xDoc.documentElement.nodeName == "parsererror") { return this.tools.exception(xDoc.documentElement.childNodes[0].nodeValue); }