r92811 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92810‎ | r92811 | r92812 >
Date:22:13, 21 July 2011
Author:inez
Status:deferred
Tags:
Comment:
Fix getLength methods for lists
Modified paths:
  • /trunk/parsers/wikidom/lib/es/es.ListBlock.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/es/es.ListBlock.js
@@ -1,3 +1,6 @@
 2+/**
 3+ * es.ListBlockList
 4+ */
25 es.ListBlockList = function( style, items ) {
36 // Convert items to es.ListBlockItem objects
47 var listItems = [];
@@ -58,6 +61,9 @@
5962
6063 es.extend( es.ListBlockList, es.Container );
6164
 65+/**
 66+ * es.ListBlockItem
 67+ */
6268 es.ListBlockItem = function( line, lists ) {
6369 // Convert items to es.ListBlockItem objects
6470 var itemLists = [];
@@ -84,6 +90,16 @@
8591 } );
8692 }
8793
 94+es.ListBlockItem.prototype.getLength = function() {
 95+ var length = this.content.getLength();
 96+ for ( var i = 0; i < this.lists.length; i++ ) {
 97+ length += this.lists[i].getLength();
 98+ }
 99+ return length;
 100+};
 101+
 102+
 103+
88104 es.ListBlockList.prototype.getLocation = function( offset ) {
89105 if ( offset < this.content.length ) {
90106 return {
@@ -102,14 +118,6 @@
103119 }
104120 };
105121
106 -es.ListBlockList.prototype.getLength = function() {
107 - var length = this.content.getLength();
108 - for ( var i = 0; i < this.lists.length; i++ ) {
109 - length += this.lists[i].getLength();
110 - }
111 - return length;
112 -};
113 -
114122 es.ListBlockItem.prototype.renderContent = function( offset ) {
115123 // TODO: Abstract offset and use it when rendering
116124 this.flow.render();
@@ -120,6 +128,9 @@
121129
122130 es.extend( es.ListBlockItem, es.Container );
123131
 132+/**
 133+ * es.ListBlock
 134+ */
124135 es.ListBlock = function( style, items ) {
125136 es.Block.call( this );
126137 this.list = new es.ListBlockList( style, items );

Status & tagging log