From 6bd5d6e4d50aa244f624ef9472cbb94afce837f8 Mon Sep 17 00:00:00 2001 From: coresh <1753595@gmail.com> Date: Tue, 18 Oct 2016 09:34:09 +0000 Subject: [PATCH] Fixes issue of method 'setTooltip' Fixes issue of method 'setTooltip' in modules/UI/util/UIUtil.js: Excluded 'Uncaught TypeError': ``` UIUtil.js:134 Uncaught TypeError: Cannot read property 'setAttribute' of null ``` --- modules/UI/util/UIUtil.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/UI/util/UIUtil.js b/modules/UI/util/UIUtil.js index 564483355..daa1b3570 100644 --- a/modules/UI/util/UIUtil.js +++ b/modules/UI/util/UIUtil.js @@ -131,10 +131,12 @@ const TOOLTIP_POSITIONS = { * @param position the position of the tooltip in relation to the element */ setTooltip: function (element, key, position) { - element.setAttribute('data-tooltip', TOOLTIP_POSITIONS[position]); - element.setAttribute('data-i18n', '[content]' + key); + if (element !== null) { + element.setAttribute('data-tooltip', TOOLTIP_POSITIONS[position]); + element.setAttribute('data-i18n', '[content]' + key); - APP.translation.translateElement($(element)); + APP.translation.translateElement($(element)); + } }, /**