From b56597f9b527fd580936fc7a5caaf12a5a2d77e5 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 11 May 2015 23:48:34 +0200 Subject: [PATCH] Properly trimming title --- wcfsetup/install/files/js/WoltLab/WCF/UI/Tooltip.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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'); } -- 2.20.1