Skip to content

Commit b96867f

Browse files
committed
refactor: do not set content if it's the same
1 parent 2d32f68 commit b96867f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/directives/BTooltip.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,14 @@ const BTooltip: Directive<HTMLElement> = {
7474
},
7575
updated(el) {
7676
const title = el.getAttribute('title')
77+
const originalTitle = el.getAttribute('data-bs-original-title')
7778

78-
if (title) {
79+
if (title && title !== originalTitle) {
7980
const instance = Tooltip.getInstance(el)
8081
instance?.setContent({'.tooltip-inner': title})
8182
el.setAttribute('data-bs-original-title', title)
82-
el.removeAttribute('title')
8383
}
84+
el.removeAttribute('title')
8485
},
8586
unmounted(el) {
8687
const instance = Tooltip.getInstance(el)

0 commit comments

Comments
 (0)