From 53c77c020368dbd570bd2d29ffc0c3660a0f6ab3 Mon Sep 17 00:00:00 2001 From: GeoSot Date: Thu, 25 Nov 2021 20:33:42 +0200 Subject: Tooltip: refactor jQueryInterface --- js/src/tooltip.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'js/src/tooltip.js') diff --git a/js/src/tooltip.js b/js/src/tooltip.js index b09ab0d0c..b0963a002 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -637,13 +637,15 @@ class Tooltip extends BaseComponent { return this.each(function () { const data = Tooltip.getOrCreateInstance(this, config) - if (typeof config === 'string') { - if (typeof data[config] === 'undefined') { - throw new TypeError(`No method named "${config}"`) - } + if (typeof config !== 'string') { + return + } - data[config]() + if (typeof data[config] === 'undefined') { + throw new TypeError(`No method named "${config}"`) } + + data[config]() }) } } -- cgit v1.2.3