Subscribe to new elements on the page #22
fregante posted onGitHub
elementReady only works for one element, but sometimes it’s useful to just get all the elements on the page as they load. For example:
elementReady.subscribe('a', shortenLink);
This will run the function on each new element found on the page before reaching DOM ready.
MutationObserver with subtree:true
would be ideal for this but somewhere at some point I read that it’s heavy to run this while the page loads as there are too many events. It would be great to actually test this and compare it to a simpler setInterval + querySelectorAll
. Without performance tests, I’d avoid MutationObserver
Note: This issue has a bounty, so it's expected that you are an experienced programmer and that you give it your best effort. Don't forget, if applicable, to add tests, docs (double-check for typos), and update TypeScript definitions. Instead of asking too many questions, present solutions. The point of an issue bounty is to reduce my workload, not give me more. Thanks for helping out 🙌
Fund this Issue
Rewarded pull request
Other pull requests
Click to copy link
Recent activities