5 ms·
What's the difference between SentinelJS and DOM Mutation Observers? I glanced at the source code, it seems this lib is using some kind of hack based on CSS an
by yeasayer 9y ago
What's the difference between SentinelJS and DOM Mutation Observers?
I glanced at the source code, it seems this lib is using some kind of hack based on CSS animations. Why not just use Mutation Observers, which are the standard approved API to get the job done?
- onion2k 9y agoMutation observers are very, very bad for performance. They're still useful for some things as they give you a lot of detail about what happened, but if you're just looking for a change on a specific set of elements this library seems like a better bet.
- paulirish 9y ago> Mutation observers are very, very bad for performance. No, they are not. Mutation events are tragic for performance and are deprecated (Chrome will make that pretty obvious in the console). The Mutation Observer was designed to have reasonable performance characteristics. It's still a very active listener, but rarely is it a bottleneck. more: https://developers.google.com/web/updates/2012/02/Detect-DOM-changes-with-Mutation-Observers https://developers.google.com/web/updates/2012/02/Detect-DOM...
- nailer 9y agoI would have thought MOs were implemented in C and thus pretty fast. Either way, even if they're slow compared to this technique at present, I haven't found performance to be an issue when using them now, and no doubt they'll be optimsied further.