What about an easy, direct way to update the tooltip content when we have something dynamic?
tooltipInstance.content(htmlNode | String);
In case of String: we just need to switch with textContent and not innerText.
ref: https://kellegous.com/j/2013/02/27/innertext-vs-textcontent/
In case of htmlNode, use .appendChild() and not .innerHTML for security purposes.
https://coderwall.com/p/o9ws2g/why-you-should-always-append-dom-elements-using-documentfragments
Opinion?
I have to check if the Bootstrap tooltips allow this already so that I can copy the API.
Otherwise we'll have to invent our own one.
Hello. I'm currently working on this issue. PR on the way.
Thank you for working on that even though it was buried pretty low :)
Just read the code, and you might not have read my initial comment:
In case of String: we just need to switch with textContent and not innerText.
ref: https://kellegous.com/j/2013/02/27/innertext-vs-textcontent/In case of htmlNode, use .appendChild() and not .innerHTML for security purposes.
https://coderwall.com/p/o9ws2g/why-you-should-always-append-dom-elements-using-documentfragments
This is needed for performance.
@hekigan sorry about that. I was missing the textContent vs innerText, it should now be fixed (see utils.js->TooltipTitleManager.addTitleContent). cc: @FezVrasta I only updated the logic which creates the new content. Let me know if the logic in Tooltip._create should also be changed to use textContent vs innerText.
As a side note, I created the utils.js file because of code climate's validations since code lines and cognitive complexity won't allow me to do everything inside tooltip\index.js
Since the modification got merged, I am going to close this issue.
Thanks @victor-cordova for your work.
Hi! Can we do the same for popper?
Most helpful comment
Hi! Can we do the same for popper?