From 470e99ed5f53f8a94df9e501fcc30423151be324 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Sat, 14 Nov 2020 15:43:25 +0200 Subject: [PATCH] tooltip.js: deduplicate `_fixTitle()` (#32124) --- js/src/tooltip.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 505f8c8532..2a55992cba 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -578,14 +578,11 @@ class Tooltip { } _fixTitle() { - const titleType = typeof this.element.getAttribute('data-bs-original-title') - - if (this.element.getAttribute('title') || titleType !== 'string') { - this.element.setAttribute( - 'data-bs-original-title', - this.element.getAttribute('title') || '' - ) + const title = this.element.getAttribute('title') + const originalTitleType = typeof this.element.getAttribute('data-bs-original-title') + if (title || originalTitleType !== 'string') { + this.element.setAttribute('data-bs-original-title', title || '') this.element.setAttribute('title', '') } }