Bug: Lightbox Spams DOM with Unused Elements

The following test was done using this sample: https://docs.dhtmlx.com/gantt/samples/01_initialization/16_projects_and_milestones.html

(I could only put one image in this post, so instead of breaking it up I have referred to it by a figure number).

If you open a light box for the first time, it creates an element in the DOM: See Figure A.

This same DOM element is used every time the lightbox is re-opened; until a different lightbox type is needed (Project, Task, Milestone, etc.): See Figure B.

If you then open a lightbox for a type that has already had it’s lightbox created- a new DOM element is then created instead of re-using the already created one: See: Figure C

This pollutes the DOM with unused lightbox elements throughout the use of the Gantt Chart.
Instead, the old element should be re-used.

Also, running the command window.gantt.resetLightbox() will only remove the most-recently created one from the DOM; all others are still left there.

Hello Kade,
Thank you for letting us know about the issue. I added it as a bug to our internal tracker. The dev team will fix it in the future, but I cannot give you any ETA.

Now, as a workaround, you can manually remove the obsolete lightbox nodes after closing the lightbox.
Here is an example:
http://snippet.dhtmlx.com/5/0fc1d4e7f

1 Like

Hello Kade,

The dev team fixed the bug with the lightbox. Now its previous DOM elements are removed after you change the lightbox type:
https://docs.dhtmlx.com/gantt/whatsnew.html#7112
You can see how it works in the following snippet:
https://snippet.dhtmlx.com/5/38ee1b370