r104883 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104882‎ | r104883 | r104884 >
Date:19:08, 1 December 2011
Author:neilk
Status:deferred
Tags:
Comment:
get rid of separate undoState function
Modified paths:
  • /trunk/extensions/VisualEditor/modules/es/models/es.SurfaceModel.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/es/models/es.SurfaceModel.js
@@ -118,12 +118,12 @@
119119 * @param {Integer} Number of document-changing states to reverse
120120 */
121121 es.SurfaceModel.prototype.undo = function( transactionsToUndo ) {
122 - /**
123 - * Undo a state.
124 - * @return {Boolean} whether visible change was undone.
125 - */
126 - function undoState( state ) {
 122+
 123+ while ( transactionsToUndo ) {
127124 var hadTransaction = false;
 125+
 126+ var state = this.currentState;
 127+
128128 var i = state.length - 1;
129129 while ( i-- ) {
130130 if ( state[i] instanceof es.TransactionModel ) {
@@ -132,11 +132,7 @@
133133 }
134134 }
135135 this.emit( 'undo', state );
136 - return hadTransaction;
137 - }
138136
139 - while ( transactionsToUndo ) {
140 - var hadTransaction = undoState( this.currentState );
141137 if ( hadTransaction ) {
142138 transactionsToUndo--;
143139 }

Status & tagging log