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
```
This commit is contained in:
coresh 2016-10-18 09:34:09 +00:00 committed by GitHub
parent 442d2fa316
commit 6bd5d6e4d5
1 changed files with 5 additions and 3 deletions

View File

@ -131,10 +131,12 @@ const TOOLTIP_POSITIONS = {
* @param position the position of the tooltip in relation to the element * @param position the position of the tooltip in relation to the element
*/ */
setTooltip: function (element, key, position) { setTooltip: function (element, key, position) {
element.setAttribute('data-tooltip', TOOLTIP_POSITIONS[position]); if (element !== null) {
element.setAttribute('data-i18n', '[content]' + key); element.setAttribute('data-tooltip', TOOLTIP_POSITIONS[position]);
element.setAttribute('data-i18n', '[content]' + key);
APP.translation.translateElement($(element)); APP.translation.translateElement($(element));
}
}, },
/** /**