File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed
Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 2222
2323- Leading newline when adding real-time inputs to empty saved input
2424- Seed for generators in stress tester not utilizing full 64-bit integer range
25+ - Tooltip not updating when the attribute changes
2526
2627### Removed
2728
Original file line number Diff line number Diff line change 134134 clearTimeout (showTimeout );
135135 clearTimeout (hideTimeout );
136136
137- const mutationObserver = new MutationObserver (() => {
138- // If the target element is no longer in the DOM, hide the tooltip
139- if (currentTarget && ! document .contains (currentTarget )) {
140- hideTooltip ();
137+ const mutationObserver = new MutationObserver ((mutations ) => {
138+ for (const mutation of mutations ) {
139+ if (mutation .type === " childList" ) {
140+ // If the target element is no longer in the DOM, hide the tooltip
141+ if (currentTarget && ! document .contains (currentTarget )) {
142+ hideTooltip ();
143+ }
144+ } else if (mutation .type === " attributes" && mutation .attributeName === " data-tooltip" ) {
145+ if (mutation .target === currentTarget ) {
146+ const text = currentTarget .getAttribute (" data-tooltip" );
147+ if (text ) {
148+ tooltipText = text ;
149+ } else {
150+ hideTooltip ();
151+ }
152+ }
153+ }
141154 }
142155 });
143156
144157 mutationObserver .observe (document .body , {
145158 childList: true ,
146159 subtree: true ,
160+ attributes: true ,
161+ attributeFilter: [" data-tooltip" ],
147162 });
148163
149164 // Hide tooltip on window resize
You can’t perform that action at this time.
0 commit comments