From: Alexander Ebert Date: Mon, 11 May 2015 21:48:34 +0000 (+0200) Subject: Properly trimming title X-Git-Tag: 3.0.0_Beta_1~2407 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b56597f9b527fd580936fc7a5caaf12a5a2d77e5;p=GitHub%2FWoltLab%2FWCF.git Properly trimming title --- diff --git a/wcfsetup/install/files/js/WoltLab/WCF/UI/Tooltip.js b/wcfsetup/install/files/js/WoltLab/WCF/UI/Tooltip.js index 97d88bd895..1563f2bcf8 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/UI/Tooltip.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/UI/Tooltip.js @@ -56,6 +56,8 @@ define(['jquery', 'UI/Alignment'], function($, UIAlignment) { element.classList.remove('jsTooltip'); var title = element.getAttribute('title'); + title = (typeof title === 'string') ? title.trim() : ''; + if (title.length) { element.setAttribute('data-tooltip', title); element.removeAttribute('title'); @@ -75,7 +77,9 @@ define(['jquery', 'UI/Alignment'], function($, UIAlignment) { _mouseEnter: function(event) { var element = event.currentTarget; var title = element.getAttribute('title'); - if (typeof title === 'string' && title !== '') { + title = (typeof title === 'string') ? title.trim() : ''; + + if (title !== '') { element.setAttribute('data-tooltip', title); element.removeAttribute('title'); }