From 78d8829d659d7ade0bbcd32aa9fad8bf7dddd05f Mon Sep 17 00:00:00 2001 From: Molkobain Date: Mon, 27 Mar 2023 18:04:01 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B06131=20-=20Improve=20robustness=20of=20t?= =?UTF-8?q?ooltips=20helper=20when=20no=20DOM=20element=20passed=20to=20Co?= =?UTF-8?q?mbodoTooltip::InitTooltipFromMarkup()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/utils.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/utils.js b/js/utils.js index 4e22b82c7..04fad01b2 100644 --- a/js/utils.js +++ b/js/utils.js @@ -794,8 +794,12 @@ const CombodoTooltip = { InitTooltipFromMarkup: function (oElem, bForce = false) { const oOptions = {}; - // First, check if the tooltip isn't already instantiated - if ((oElem.attr('data-tooltip-instantiated') === 'true') && (bForce === false)) { + // First, check if the jQuery element actually represent DOM elements + if (oElem.length === 0) { + return false; + } + // Then, check if the tooltip isn't already instantiated + else if ((oElem.attr('data-tooltip-instantiated') === 'true') && (bForce === false)) { return false; } else if((oElem.attr('data-tooltip-instantiated') === 'true') && (bForce === true) && (oElem[0]._tippy !== undefined)){