You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Okay, I was doing a search results display work, and every search result has a button that renders tooltips, here is the simplified code, they are already working fine for me:
letsearchAndDisplayResults=(function(){lettooltips;return(key)=>{// search results containerletsearchContainer=$('.search-results-container');// clear elements firstsearchContainer.html('');// get search results information arrayletsearchedResultsArray=getSearchedResults(key);// render search results to page(simplified)searchedResultsArray.forEach((ele)=>{searchContainer.append(`<div>${ele}</div><i class='bi-plus' data-bs-toggle="tooltip" title="Some hint for this button"></i>`);}// enable tooltiptooltips=[].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')).map(tooltipTriggerEl=>{returnnewbootstrap.Tooltip(tooltipTriggerEl)});}})();
The code that enables tooltips above is from here.
Every time new search key was passed into the function, the old search results' elements will be destroyed and re-rendered, but it seems it remains variable tooltips not to delete every time search results were re-rendered.
So in order to save browser memory consuming, I wonder if I need to delete tooltips array everytime search results were re-rendered?
For example, should I use code like this below to clear tooltips everytime new search results tend to render?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Okay, I was doing a search results display work, and every search result has a button that renders tooltips, here is the simplified code, they are already working fine for me:
The code that enables tooltips above is from here.
Every time new search key was passed into the function, the old search results' elements will be destroyed and re-rendered, but it seems it remains variable
tooltips
not to delete every time search results were re-rendered.So in order to save browser memory consuming, I wonder if I need to delete tooltips array everytime search results were re-rendered?
For example, should I use code like this below to clear
tooltips
everytime new search results tend to render?This question I have also asked in StackOverflow.
Beta Was this translation helpful? Give feedback.
All reactions