N°6131 - Improve robustness of tooltips helper when no DOM element passed to CombodoTooltip::InitTooltipFromMarkup()

This commit is contained in:
Molkobain
2023-03-27 18:04:01 +02:00
parent 307edd3f7a
commit 78d8829d65

View File

@@ -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)){