From e91c4ef56cac63ae8be8766b0e21bcf4c92b3123 Mon Sep 17 00:00:00 2001 From: Ere Maijala Date: Fri, 4 Dec 2020 14:55:43 +0200 Subject: [PATCH] Fix check for element length in account_ajax.js. Also adds check for INACTIVE sub. --- themes/bootstrap3/js/account_ajax.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/themes/bootstrap3/js/account_ajax.js b/themes/bootstrap3/js/account_ajax.js index 4327ae25020..f8c9ed85f13 100644 --- a/themes/bootstrap3/js/account_ajax.js +++ b/themes/bootstrap3/js/account_ajax.js @@ -50,12 +50,16 @@ VuFind.register('account', function Account() { var accountStatus = ICON_LEVELS.NONE; for (var sub in _submodules) { if (Object.prototype.hasOwnProperty.call(_submodules, sub)) { + var status = _getStatus(sub); + if (status === INACTIVE) { + continue; + } var $element = $(_submodules[sub].selector); - if (!$element) { + if ($element.length === 0) { + // This could happen if the DOM is changed dynamically _statuses[sub] = INACTIVE; continue; } - var status = _getStatus(sub); if (status === MISSING) { $element.addClass('hidden'); } else {