From 6424fe33ae145f4fd9d881979d0db39460985696 Mon Sep 17 00:00:00 2001 From: yigitfindikli Date: Wed, 30 Mar 2022 14:40:04 +0300 Subject: [PATCH] Fixed #2363 --- src/components/tooltip/Tooltip.js | 16 +++++++++++++--- src/components/utils/ObjectUtils.js | 10 ---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/components/tooltip/Tooltip.js b/src/components/tooltip/Tooltip.js index 791caddb8..a1af024cc 100755 --- a/src/components/tooltip/Tooltip.js +++ b/src/components/tooltip/Tooltip.js @@ -1,4 +1,4 @@ -import {UniqueComponentId,DomHandler,ConnectedOverlayScrollHandler,ZIndexUtils,ObjectUtils} from 'primevue/utils'; +import {UniqueComponentId,DomHandler,ConnectedOverlayScrollHandler,ZIndexUtils} from 'primevue/utils'; function bindEvents(el) { const modifiers = el.$_ptooltipModifiers; @@ -106,8 +106,14 @@ function create(el) { let tooltipText = document.createElement('div'); tooltipText.className = 'p-tooltip-text'; - let tooltipLabel = ObjectUtils.htmlEncode(el.$_ptooltipValue); - tooltipText.innerHTML = tooltipLabel; + + if (el.$_ptooltipEscape) { + tooltipText.innerHTML = el.$_ptooltipValue; + } + else { + tooltipText.innerHTML = ''; + tooltipText.appendChild(document.createTextNode(el.$_ptooltipValue)); + } container.appendChild(tooltipText); document.body.appendChild(container); @@ -285,11 +291,13 @@ const Tooltip = { else if (typeof options.value === 'string') { target.$_ptooltipValue = options.value; target.$_ptooltipDisabled = false; + target.$_ptooltipEscape = false; target.$_ptooltipClass = null; } else { target.$_ptooltipValue = options.value.value; target.$_ptooltipDisabled = options.value.disabled || false; + target.$_ptooltipEscape = options.value.escape || false; target.$_ptooltipClass = options.value.class; } @@ -316,11 +324,13 @@ const Tooltip = { if (typeof options.value === 'string') { target.$_ptooltipValue = options.value; target.$_ptooltipDisabled = false; + target.$_ptooltipEscape = false; target.$_ptooltipClass = null; } else { target.$_ptooltipValue = options.value.value; target.$_ptooltipDisabled = options.value.disabled || false; + target.$_ptooltipEscape = options.value.escape || false; target.$_ptooltipClass = options.value.class; } } diff --git a/src/components/utils/ObjectUtils.js b/src/components/utils/ObjectUtils.js index 6fccee280..3f153531d 100755 --- a/src/components/utils/ObjectUtils.js +++ b/src/components/utils/ObjectUtils.js @@ -204,16 +204,6 @@ export default { return null; }, - htmlEncode(str){ - if (str) { - return str.replace(/[^\w. ]/gi, function(c){ - return '&#'+c.charCodeAt(0)+';'; - }); - } - - return null; - }, - isEmpty(value) { return ( value === null || value === undefined || value === '' ||