Expounding on "opt-in for performance reasons"
In the documentation for both Tooltips and Popovers is the caveat: "opt-in for performance reasons, so you must initialize them yourself." But I'm having trouble finding a detailed explanation of "performance reasons." The caveat is at least 6 years old, which makes me wonder if it's still true.
Also, many people miss this caveat when reading the documentation, for example #24985 and #15458. So it would be great if Tooltips and Popovers could actually be automatically initialized in a performant way. That might also pair nicely with using MutationObserver to automatically remove Tooltips in v5.
Hi @jonathanhefner, there is a way to do that, you can use our selector option and it'll initialize Popovers and Tooltip automatically.
Maybe after the switch to our v5 (without jQuery) we can remove that 🤔
Bumping @twbs/js-review on this—would we want to make this the default in v5? Is that a breaking change that we'd need to punt to v6?
TBH we need some kind of benchmark before everything else. The reasons behind this choice may no longer apply to v5, but it can indeed be a breaking change.
Follow up / tangential to this as a user of bootstrap:
- The "opt-in" requirement and guidance already seemed weird because adding the `data-[bs-]toggle='tooltip`` attribute to an element already is EXPLICIT that you want tool-tip popup behavior.
- Inconsistency with other controls - why the additional extra step of manual JavaScript initialization when default behavior it to self-initialize from data attributes.
I agree with @XhmikosR on needing to re-evaluate this. @twbs/js-review Can any of you review and make a suggestion for how to better handle tooltips and popovers here without requiring extra work?
I think we drop this entirely and make them automatically work. Adding to v6 plans.