r100990 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100989‎ | r100990 | r100991 >
Date:15:55, 27 October 2011
Author:tparscal
Status:ok
Tags:
Comment:
Fixed code that checks "edges" - data.length is the edge, not data.length - 1
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
@@ -500,7 +500,7 @@
501501 */
502502 es.DocumentModel.isContentOffset = function( data, offset ) {
503503 // Content can't exist at the edges
504 - if ( offset > 0 && offset < data.length - 1 ) {
 504+ if ( offset > 0 && offset < data.length ) {
505505 // Shortcut: if there's already content there, we will trust it's supposed to be there
506506 if ( typeof data[offset] === 'string' || $.isArray( data[offset] ) ) {
507507 return true;
@@ -555,7 +555,7 @@
556556 */
557557 es.DocumentModel.isStructuralOffset = function( data, offset ) {
558558 // Edges are always structural
559 - if ( offset === 0 || offset === data.length - 1 ) {
 559+ if ( offset === 0 || offset === data.length ) {
560560 return true;
561561 }
562562 // Structual offsets will have elements on each side

Status & tagging log