silk.images = ( xb.core.object.extend( { ctor: function() { return; var self = this; this.observer = new MutationObserver( function( mutation ) { self.onMutation( mutation ); } ) this.observer.observe( document, { childList: true, subtree: true, } ); }, onMutation: function( mutations ) { for ( var i = 0, il = mutations.length; i < il; i++ ) { var mutation = mutations[ i ]; $( mutation.addedNodes ) .find( "img" ) .each( function() { console.log( "added", this ); this.addEventListener( "load", function( evt ) { console.log( "loaded", evt.target.width, evt.target.height ); } ); } ) ; } }, } ) )();