-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JavaScript Instances registry, faulty re-set new instance #37245
Comments
@XhmikosR can you remember something on the following test, or explain it? bootstrap/js/tests/unit/dom/data.spec.js Lines 56 to 66 in 5975ca6
|
Hi everyone, 👋 is this by chance also related to this topic? #35710 If yes I would postpone a workaround re-initializing Popover and Tooltip every time manually after dynamic content changes and use the "selector" option instead. |
also, old versions using jQuery, not throws error if selector not exists - need add "silent mode" to keep BC |
Hey @tobiasberge, it is a bit different, and the tooltip after 5.1.3 (I am not sure of the version) re-initializes its self every time |
@GeoSot Thanks for your answer, good to know. We wanted to update to 5.2.x anyway. 👍 |
Prerequisites
Describe the issue
Bootstrap's Instances registry, by design, doesn't support multiple instances per element. However, in the rare case we are trying to re-initiate the same component for second time, it wrongly overrides the already existing instance
I found this flaw on #37195, where two tooltips were created using the same element
and is caused on this method
bootstrap/js/src/dom/data.js
Lines 15 to 31 in da0fe8c
Steps to reproduce
bootstrap/js/src/dom/data.js
Line 30 in da0fe8c
new Toast(myelement)
new Toast(myelement)
Reduced test cases
https://codepen.io/GeosSV/pen/gOzzWYV?editors=1011
What operating system(s) are you seeing the problem on?
Windows, macOS, Android, iOS, Linux
What browser(s) are you seeing the problem on?
Chrome, Safari, Firefox, Microsoft Edge, Opera
What version of Bootstrap are you using?
v5.2.2
The text was updated successfully, but these errors were encountered: