[FIX] website: ace: client side add a try catch to DOMParser for IE

bzr revid: chm@openerp.com-20140221100853-50smr3ii8jrcq178
This commit is contained in:
Christophe Matthieu 2014-02-21 11:08:53 +01:00
parent d5106a4d34
commit 960ac4bca8
1 changed files with 8 additions and 2 deletions

View File

@ -39,9 +39,15 @@
this.xml = text;
},
isWellFormed: function () {
var error;
if (document.implementation.createDocument) {
var dom = new DOMParser().parseFromString(this.xml, "text/xml");
var error = dom.getElementsByTagName("parsererror");
// use try catch for ie
try {
var dom = new DOMParser().parseFromString(this.xml, "text/xml");
error = dom.getElementsByTagName("parsererror");
} catch (e) {
error = e;
}
return error.length === 0 || error;
} else if (window.ActiveXObject) {
// TODO test in IE