machawk1 / Mink

Chrome extension that uses Memento to indicate that a page a user is viewing on the live web has an archived copy and to give the user access to the copy
MIT License
47 stars 3 forks source link

Consider using Polymer to replace custom shadow DOM UI #240

Open machawk1 opened 7 years ago

machawk1 commented 7 years ago

In #77 we adapted the UI to use the Shadow DOM but there are still cases (examples?) where the container page is affecting the Mink UI. As recommended in that ticket, Polymer offers custom UI elements that would make the Mink UI less awkward and potentially easier to both maintain and manipulate in the future.

machawk1 commented 6 years ago

The page affecting the Mink UI should no longer be an issue, but moving over to a custom element based shadow DOM like https://github.com/oduwsdl/reconstructive does as integrated into https://github.com/oduwsdl/ipwb would give more control without the page's style of conventional elements (the Mink UI is currently made up of standard HTML elements) affecting the Mink UI.

ibnesayeed commented 6 years ago

Since Mink is Chrome specific, which has excellent support of Web Components, we don't need Polymer for this (though we can use it if we want to). That will be one less dependency to worry about while utilizing native browser capabilities and standard JS syntax.

While adding a custom element or some generic HTML elements inside a shadow DOM isolates the style, we must be careful when adding any events listeners on global objects such as on window. The page in question might have some event listeners attached to it already, so we need to append to it rather than overwriting existing event listeners.

machawk1 commented 6 years ago

@ibnesayeed That's the idea and thanks for the insight. I believe Mink does not currently write any event listeners on the window and only interacts with the browser's window instance when using localStorage.