r92152 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92151‎ | r92152 | r92153 >
Date:11:41, 14 July 2011
Author:hashar
Status:deferred
Tags:
Comment:
Block.Index() -> Block.getIndex()
Modified paths:
  • /trunk/parsers/wikidom/lib/es/es.Document.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/es/es.Document.js
@@ -60,11 +60,24 @@
6161 Document.prototype.insertBlockBefore = function( block, before ) {
6262 block.document = this;
6363 if ( before ) {
64 - this.blocks.splice( before.index(), 0, block );
 64+ this.blocks.splice( before.getIndex(), 0, block );
6565 } else {
6666 this.blocks.push( block );
6767 }
6868 };
 69+/**
 70+ * Adds a block to the document after an existing block.
 71+ * @param block {Block} Block to insert
 72+ * @param after {Block} Block to insert after, if null then block will be inserted at the end
 73+ */
 74+Document.prototype.insertBlockAfter = function( block, after ) {
 75+ block.document = this;
 76+ if ( after ) {
 77+ this.blocks.splice( after.getIndex() + 1, 0, block );
 78+ } else {
 79+ this.blocks.push( block );
 80+ }
 81+}
6982
7083 /**
7184 * Removes a block from the document.
@@ -72,7 +85,7 @@
7386 * @param {Block} Block to remove
7487 */
7588 Document.prototype.removeBlock = function( block ) {
76 - this.blocks.splice( block.index(), 1 );
 89+ this.blocks.splice( block.getIndex(), 1 );
7790 block.document = null;
7891 };
7992

Status & tagging log