uzairfarooq / arrive

Watch for DOM elements creation and removal
MIT License
869 stars 99 forks source link

arrive.js not triggering consistently #33

Closed jaredsohn closed 9 years ago

jaredsohn commented 9 years ago

Thanks for this library; it has made things much easier to work with compared to raw mutation observers and mutation-summary.

I am presently making heavy use of arrive.js calls in the early stages of a Chrome extension rewrite and find that sometimes arrive.js is missing the changes. In these situations, often if I restart Chrome it works again. I know that there are a lot of changes that I can make to improve performance (combine redundant arrive.js calls, scope them to more specific parents instead of document.body, cancel them when I know that they are no longer relevant, and maybe drop down to raw mutation observers in certain circumstances. but I am wondering if you have any information about Chrome limitations with respect to using a large number of mutation observers and if the behavior that would occur in such a circumstance matches the behavior I am experiencing.

uzairfarooq commented 9 years ago

I don't think there's any such limitation in MutationObservers. If it misses some elements, it might be a bug in arrive.js (although I've used it in many projects and never faced such an issue). Are there any steps to reproduce it or it happens randomly?

jaredsohn commented 9 years ago

My problems came about because I wasn't capturing exceptions prior to calling arrive so arrive never got called. Restarting Chrome would fix things because this site will change the URL when you reload the page which would change the DOM in a way that would cause my code to throw exceptions.