From d3c481fcf69bc39caeded96f5e8eb14c3c28a292 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 5 Oct 2020 23:36:06 -0400 Subject: [PATCH] Fix bundled attr() when attribute doesn't exist Regression from 4efc0af119 --- chrome/content/zotero/xpcom/translation/translate.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index ed3893690e..565b93c2a5 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -1871,7 +1871,8 @@ Zotero.Translate.Base.prototype = { var elem = index ? docOrElem.querySelectorAll(selector).item(index) : docOrElem.querySelector(selector); - return (elem ? elem.getAttribute(attr) : "").trim(); + if (!elem) return ""; + return (elem.hasAttribute(attr) ? elem.getAttribute(attr) : "").trim(); }, /**