r112834 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112833‎ | r112834 | r112835 >
Date:20:52, 1 March 2012
Author:inez
Status:deferred
Tags:
Comment:
Explicitly pass parameter global=true to getOffset method
Modified paths:
  • /trunk/extensions/VisualEditor/modules/ve/ce/ve.es.Surface.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/ve/ce/ve.es.Surface.js
@@ -298,15 +298,15 @@
299299 };
300300
301301 ve.es.Surface.prototype.getSelection = function() {
302 - var selection = rangy.getSelection();
 302+ var rangySel = rangy.getSelection();
303303
304 - if ( selection.anchorNode === selection.focusNode && selection.anchorOffset === selection.focusOffset ) {
305 - var offset = this.getOffset( selection.anchorNode, selection.anchorOffset );
 304+ if ( rangySel.anchorNode === rangySel.focusNode && rangySel.anchorOffset === rangySel.focusOffset ) {
 305+ var offset = this.getOffset( rangySel.anchorNode, rangySel.anchorOffset, true );
306306 return new ve.Range( offset, offset );
307307 } else {
308308 return new ve.Range(
309 - this.getOffset( selection.anchorNode, selection.anchorOffset ),
310 - this.getOffset( selection.focusNode, selection.focusOffset )
 309+ this.getOffset( rangySel.anchorNode, rangySel.anchorOffset, true ),
 310+ this.getOffset( rangySel.focusNode, rangySel.focusOffset, true )
311311 );
312312 }
313313 };

Status & tagging log