Refactor renderContents() deduplication code

Change-Id: Ib8672b51fc236cac805b88a99d07b3c496548cbd
This commit is contained in:
Inez Korczyński 2013-04-23 16:01:01 -07:00
parent f00da336a5
commit f21a385bd9

View file

@ -32,10 +32,13 @@ ve.ce.ContentBranchNode = function VeCeContentBranchNode( model, $element ) {
// have in mind that this transaction here is not being used in any other way than just as
// a flag to figure out if renderContents should be executed or not.
this.on( 'childUpdate', ve.bind( function( transaction ) {
if ( !lastTransaction || lastTransaction !== transaction ) {
if ( transaction instanceof ve.dm.Transaction ) {
if ( lastTransaction === transaction ) {
return;
}
lastTransaction = transaction;
this.renderContents();
}
this.renderContents();
}, this ) );
// Initialization