ibm-js / delite

HTML Custom Element / Widget infrastructure
http://ibm-js.github.io/delite/
Other
68 stars 28 forks source link

delite/popup: replace polling #506

Closed wkeese closed 5 years ago

wkeese commented 5 years ago

Try to replace the polling and excessive MutationObserver usage in delite/popup.

Currently it uses polling to check if:

It also uses MutationObserver to check if the popup changed size due to DOM nodes being added/removed, classes changed, etc.

While we still need to use MutationObserver to detect if the popup's class has changed, we can use #505 to detect if the size has changed.

As for scrolling, we can detect scrolling on the viewport or a nested element via:

document.addEventListener("scroll", function () { console.log("document scroll capture"); }, true)

We can even check whether the evt.target is an ancestor of the anchor node or not. Perhaps that functionality should also be put in an independent class (like #505) too.