Index: trunk/extensions/VisualEditor/modules/es/models/es.DocumentModel.js |
— | — | @@ -262,11 +262,13 @@ |
263 | 263 | * @param {Array} annotations Annotations to apply |
264 | 264 | */ |
265 | 265 | 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 ); |
269 | 272 | } |
270 | | - data[i] = [data[i]].concat( annotations ); |
271 | 273 | } |
272 | 274 | }; |
273 | 275 | |