Closed timwis closed 6 years ago
Thanks for the suggestion! Adding more details on how it works sounds like a good idea.
I tried implementing this with Mutation Observers but was unable to make it work. As far as I can tell the way to implement this with Mutation Observers is to add an observer to the document
element with childList=true, subtree=true
and iterate (recursively) through every new node added to the DOM. This might work for sites that aren't very dynamic but in general the @keyframes
method should be more performant. Of course I'd like to be proven wrong because I do believe we need built-in browser support for detecting new nodes at arbitrary points in the DOM tree in a performant way!
Let me know if this is helpful: https://github.com/muicss/sentineljs/blob/master/README.md#introduction
Looks great, thanks!
Hey, clever library! I was looking for something like this to facilitate sharing components between JS SPAs and WordPress sites.
May I suggest a paragraph in the readme that explains how it works and whether there are any tradeoffs? I figured it out from the source but it would have been great to see a sentence or two summarizing it.
Did you consider using a mutation observer to detect new elements instead of animate events? Looks like this has slightly more browser support but mutation observer is pretty good.