Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement MutationObserver support with poller fallback #2

Open
AlicanC opened this issue Feb 1, 2015 · 0 comments
Open

Implement MutationObserver support with poller fallback #2

AlicanC opened this issue Feb 1, 2015 · 0 comments
Assignees

Comments

@AlicanC
Copy link
Contributor

AlicanC commented Feb 1, 2015

We should be able to detect all changes in DOM with MutationObservers. This should eliminate the need of polling with setTimeout()s for detecting changes after DOMContentReady.

If we can't find MutationObserver support in a browser, we can fallback to polling with setTimeout()s.

It should also be noted that if the poller turns itself off after a few runs like we did in other implementations, we won't be able to detect changes in a single-page application. We could detect hashchange to re-run the poller, but there is no event to listen for history.pushState() or history.replaceState() and wrapping them is dirty.

So, to wrap up:

  • If there is MutationObserver support, we are fine.
  • If not, we have to poll every X miliseconds and look for new IFRAMES.
  • We can provide an option (_mlle.spa = false;?) to limit polling to a few seconds, but polling won't be that resource consuming.
@AlicanC AlicanC self-assigned this Feb 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant