r99603 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99602‎ | r99603 | r99604 >
Date:23:47, 11 October 2011
Author:catrope
Status:deferred
Tags:
Comment:
Implement prepareInsertion() very naively. All tests pass now, yay!
Modified paths:
  • /trunk/parsers/wikidom/lib/hype/models/es.DocumentModel.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/hype/models/es.DocumentModel.js
@@ -545,7 +545,17 @@
546546 */
547547 es.DocumentModel.prototype.prepareInsertion = function( offset, data ) {
548548 var tx = new es.Transaction();
 549+ if ( offset > 0 ) {
 550+ tx.pushRetain( offset );
 551+ }
 552+ // TODO check for structural changes
 553+ tx.pushInsert( data );
 554+ if ( offset < this.data.length ) {
 555+ tx.pushRetain( this.data.length - offset );
 556+ }
549557
 558+ return tx;
 559+
550560 /*
551561 * // Structural changes
552562 * There are 2 basic types of locations the insertion point can be:

Status & tagging log