edit: already happened once with this very project. they started animating clip, but then ie optimised it and now they use outlineColor.
Am on my phone tho, so may have misread.
It adds a faux `animation` keyframe for the specified CSS selector.
http://www.backalleycoder.com/2012/04/25/i-want-a-damnodeins...
I'd actually completely forgotten about mutation observers too - they'd got mentally filed away under "browser vendors are why we can't have nice things".
Or you're writing one of the nine hundred, and the user made the node.
[1] https://github.com/fengari-lua/fengari-web
[2] https://github.com/fengari-lua/fengari-web/blob/4279f4b3aec063062eb8baf68a065ee5b0c1d7c6/src/fengari-web.js#L132
[3] https://github.com/fengari-lua/fengari-web/issues/15For those wondering what this is for, I've written a document with guidelines in building scalable non-SPA apps leveraging this: http://ricostacruz.com/rsjs
http://www.backalleycoder.com/2012/04/25/i-want-a-damnodeins...
(Mutation events deprecated since ~5 years ago, yes. )
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?
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...
That appears if not hacky then a bit heavyweight - 2 passes of layout needed at least.
But I do understand the need for this. In sciter I've added special CSS property aspect that takes name of the function to execute when element gets mounted into the DOM and before any layout on it:
my-component {
aspect: MyComponent url(script/my-components.js);
color:blue;
}
and script: function MyComponent() {
this // is the element just added to the DOM.
} 0. Browser starts parsing the document
1. Sentiel.js loads (ie. by blocking script tag)
2. Handler is set for .my-component (ie. by inline script tag)
3. Browser parses <div class="my-component" />
4. Handler is fired for .my-component
5. Browser parses rest of document
6. DOMContentLoaded is fired.
Will the .my-component handler will always fire after DOMContentLoaded or have you experienced that it might happen before? I guess it reduces to the question if key-frame-handlers will fire before the document is fully loaded/rendered.