Emit rerender on math node if Tex image is not present

This happens with then empty tag is rendered.

Bug: 63093
Change-Id: I5cf731cedda134d2542946da82997bddf58b00b5
This commit is contained in:
Ed Sanders 2014-03-31 16:07:59 -07:00
parent a8625fd0ed
commit 31df8ff3a8
1 changed files with 11 additions and 3 deletions

View File

@ -48,7 +48,9 @@ ve.ce.MWMathNode.prototype.onParseSuccess = function ( deferred, response ) {
};
/** */
ve.ce.MWExtensionNode.prototype.afterRender = function ( domElements ) {
ve.ce.MWMathNode.prototype.afterRender = function ( domElements ) {
var $img;
if ( this.$( domElements ).is( 'span.tex' ) ) {
// MathJax
MathJax.Hub.Queue(
@ -56,10 +58,16 @@ ve.ce.MWExtensionNode.prototype.afterRender = function ( domElements ) {
[ this, this.emit, 'rerender' ]
);
} else {
$img = this.$element.find( 'img.tex' );
// Rerender after image load
this.$element.find( 'img.tex' ).on( 'load', ve.bind( function () {
if ( $img.length ) {
$img.on( 'load', ve.bind( function () {
this.emit( 'rerender' );
}, this ) );
} else {
// Passing an empty string returns no image, so rerender immediately
this.emit( 'rerender' );
}, this ) );
}
}
};