Join GitHub today
Popup: add a check to not add ui-popover-container if it's already on the page #4661
I'm feeding content to a page via AJAX.
Most content blocks contain a few popups, which once pulled into DOM add the ui-popover-container div. All good.
However, once I remove a content section (including the embedded popups), the popover-containers stay in the DOM. Next time I re-loaded the content, the popover containers get added again, so eventually my DOM is mostly popover-containers :-)
I'm now removing them by hand when leaving the page.
A better solution would be for the popover to check if the corresponding container was already there, and if so, don't add it again.
Running into this issue with custom select menu's.
Probably would be best to register/tie the ui-popup-container ui-selectmenu-hidden to it's select menu.
Sorry, I missed to answer on this issue. @mspisars is correct, I'm pulling in a lot of dynamic content via Ajax, so for stuff like news messages, I use a shell page and pull in/out blocks of content (including popups). Content blocks are removed using remove(), but - understandably - this will probably not remove any dependent elements outside of the ditched content.
So right now, I feel like uninstalling something from windows and having all sorts of leftover files cluttering the DOM :-D
Just thinking... could elements such as the overlay have a data-dependency-on="some_element_id" to auto-remove once the dependent element is removed (but how to check without wasting resources)? I'm also hoping these things can eventually be made global elements (global overlay, global popup container, global toolbar... just as the loader...).