diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWExtensionNode.js b/modules/ve-mw/ce/nodes/ve.ce.MWExtensionNode.js index abe4ff1a33..500a6b4967 100644 --- a/modules/ve-mw/ce/nodes/ve.ce.MWExtensionNode.js +++ b/modules/ve-mw/ce/nodes/ve.ce.MWExtensionNode.js @@ -97,12 +97,20 @@ ve.ce.MWExtensionNode.prototype.onParseSuccess = function ( deferred, response ) /** */ ve.ce.MWExtensionNode.prototype.afterRender = function () { - var node = this; - // Rerender after images load - // TODO: ignore shields, and count multiple images - this.$element.find( 'img' ).on( 'load', function () { - node.emit( 'rerender' ); - } ); + var node = this, + $images = this.$element.find( 'img:not([width]),img:not([height])' ); + + // Images missing a dimension change size after load + // TODO: Ignore images which have dimensions defined in CSS, if performant + if ( $images.length ) { + $images.on( 'load', function () { + // Mixin method + ve.ce.GeneratedContentNode.prototype.afterRender.call( node ); + } ); + } else { + // Mixin method + ve.ce.GeneratedContentNode.prototype.afterRender.call( this ); + } }; /**