From cd6d528519b888d96ee1da322321098d7271a347 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Sat, 4 Aug 2012 19:37:54 -0400 Subject: [PATCH] Be more resilient when IE DOMParser fails Fixes JSTOR in IE --- chrome/content/zotero/xpcom/utilities.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index bc9a0bca97..5e3e3fe39e 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -970,6 +970,10 @@ Zotero.Utilities = { var rootDoc = element.ownerDocument; } else if(element.documentElement) { var rootDoc = element; + } else if(Zotero.isIE && element.documentElement === null) { + // IE: documentElement may be null if there is a parse error. In this + // case, we don't match anything to mimic what would happen with DOMParser + continue; } else { throw new Error("First argument must be either element(s) or document(s) in Zotero.Utilities.xpath(elements, '"+xpath+"')"); }