Open l0co opened 10 years ago
Hi, have you found how to delete all tooltip content from DOM? thanks
I no longer remember this case well, but doesn't this patch do it exactly?
I am using the latest version and even with removeElementsOnHide: true, my dynamic layout would keep adding tooltips on top of each other after each of my renders. I tried to delete the data from each element, I tried to delete the Opentips.tip array, and it woudln't get rid of the duplicate opentips. I don't know where they are being stored, but this finally allowed me to programatically clear them all out so I only had one set of opentips on every render update in my app:
// clear all old opentips while (Opentip.tips.length > 0) { Opentip.tips.shift().deactivate(); }
...
// when iterating over DOM elements, clear data bound to each individual element $(this).data('opentips', []);
It would be really convenient to provide a method to do this automatically?
My usecase is to use opentips in fully ajaxed application (only one page refresh at start, then ajax - no reloads). But I don't want tips, but rather the help layer triggered by the help button that shows tips aligned to elements on demand. For such usage I need to instantiate all opentips on request, and remove them on help close action. For this I would need the opentips completely killed when I close all this stuff (clear dom elements, remove listeners, remove them from buffers). I believe here is a working patch doing this for 2.4.6: