Skip to content

Commit 48af048

Browse files
Update ToolTip element content when title config prop changes
1 parent eee95bf commit 48af048

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/classes/tooltip.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,21 @@ class ToolTip {
166166
// Stop/Restart listening
167167
this.unListen();
168168
this.listen();
169+
170+
if (typeof updatedConfig.title === 'undefined') {
171+
// We've recieved a new config without a title, hide the tooltip
172+
this.hide();
173+
} else if (prevConfig.title !== updatedConfig.title) {
174+
// We've recieved a new title that differs from the previous one,
175+
// set the new element content and update positioning
176+
this.setElementContent(select(Selector.TOOLTIP_INNER, this.$tip), this.getTitle());
177+
this.update();
178+
179+
if (typeof prevConfig.title === 'undefined') {
180+
// There was no previous title set, so we also need to show the tooltip
181+
this.show();
182+
}
183+
}
169184
}
170185

171186
// Destroy this instance

0 commit comments

Comments
 (0)