MitchellMarkGeorge / TabButler

A tab manager at your service.
https://tabbutler.netlify.app/
MIT License
43 stars 5 forks source link

New injection strategy #69

Closed MitchellMarkGeorge closed 2 years ago

MitchellMarkGeorge commented 2 years ago

Description

The purpose of this change is to change how the Search modal is shown is injected into the webpage. Previously, the tab-butler-modal element was created and appended to the body when the content script is first executed and is reused when it is triggered again by the. This proved problematic for sites where their DOM structure would change too much and affect how the modal was shown (if it shows at all). Another problem with this old strategy is that the tab-butler-modal element would be created even if you never triggered the modal, which consumes memory.

Type of changes made

Please delete options that are not relevant.

What changes were made

With this new strategy, the tab-butler-modal element is dynamically created and appended to the body only when triggered and is disposed of when closed, consuming less memory in the long run. It also makes sure that every time it is injected into a site with a lot of DOM changes, the modal will always be inserted as the last child of the body, ensuring that the modal will render correctly every time.