r103490 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103489‎ | r103490 | r103491 >
Date:18:54, 17 November 2011
Author:tparscal
Status:ok (Comments)
Tags:
Comment:
Fixed passing global offset to emit event, preventing render from re-rendering because it thought the render-from point was well past it's length
Modified paths:
  • /trunk/extensions/VisualEditor/modules/es/es.TransactionProcessor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/es/es.TransactionProcessor.js
@@ -275,7 +275,8 @@
276276 // Update the linear model
277277 this.model.data.splice( this.cursor, op.data.length );
278278 // Emit an update so things sync up
279 - node.emit( 'update', this.cursor );
 279+ var offset = this.model.getOffsetFromNode( node );
 280+ node.emit( 'update', this.cursor - offset );
280281 }
281282 };
282283

Comments

#Comment by Catrope (talk | contribs)   15:17, 30 November 2011

This is OK, but it does cause double traversal because both getNodeFromOffset() and getOffsetFromNode() are called. We should have a function that returns both the node and the offset within that node, or something like that.

Status & tagging log