r105357 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105356‎ | r105357 | r105358 >
Date:21:28, 6 December 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Bypass processing if there's no annotations
Modified paths:
  • /trunk/extensions/VisualEditor/modules/es/models/es.DocumentModel.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/es/models/es.DocumentModel.js
@@ -262,11 +262,13 @@
263263 * @param {Array} annotations Annotations to apply
264264 */
265265 es.DocumentModel.addAnnotationsToData = function( data, annotations ) {
266 - for ( var i = 0; i < data.length; i++ ) {
267 - if ( es.isArray( data[i] ) ) {
268 - data[i] = [data[i]];
 266+ if ( annotations && annotations.length ) {
 267+ for ( var i = 0; i < data.length; i++ ) {
 268+ if ( es.isArray( data[i] ) ) {
 269+ data[i] = [data[i]];
 270+ }
 271+ data[i] = [data[i]].concat( annotations );
269272 }
270 - data[i] = [data[i]].concat( annotations );
271273 }
272274 };
273275

Status & tagging log