Index: trunk/extensions/VisualEditor/modules/es/es.TransactionProcessor.js |
— | — | @@ -307,8 +307,14 @@ |
308 | 308 | var ranges = this.model.selectNodes( new es.Range( this.cursor, this.cursor + op.data.length ) ); |
309 | 309 | |
310 | 310 | // Build the list of nodes to rebuild and the data to keep |
311 | | - var oldNodes = [], newData = [], parent = null, index = null, firstKeptNode, lastKeptNode; |
312 | | - for ( var i = 0; i < ranges.length; i++ ) { |
| 311 | + var oldNodes = [], |
| 312 | + newData = [], |
| 313 | + parent = null, |
| 314 | + index = null, |
| 315 | + firstKeptNode, |
| 316 | + lastKeptNode, |
| 317 | + i; |
| 318 | + for ( i = 0; i < ranges.length; i++ ) { |
313 | 319 | oldNodes.push( ranges[i].node ); |
314 | 320 | if ( ranges[i].range !== undefined ) { |
315 | 321 | // We have to keep part of this node |
— | — | @@ -349,9 +355,11 @@ |
350 | 356 | // node we visit and verify that the transaction is a valid merge (i.e. it satisfies |
351 | 357 | // the merge criteria in prepareRemoval()'s canMerge()). |
352 | 358 | // FIXME: The code is essentially the same as canMerge(), merge these algorithms |
353 | | - var openings = [], closings = [], |
| 359 | + var openings = [], |
| 360 | + closings = [], |
354 | 361 | paths = es.DocumentNode.getCommonAncestorPaths( firstKeptNode, lastKeptNode ), |
355 | | - i, prevN1, prevN2; |
| 362 | + prevN1, |
| 363 | + prevN2; |
356 | 364 | |
357 | 365 | if ( !paths ) { |
358 | 366 | throw 'Removal is not a valid merge: nodes do not have a common ancestor or are not at the same depth'; |