r94849 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94848‎ | r94849 | r94850 >
Date:00:01, 18 August 2011
Author:inez
Status:deferred
Tags:
Comment:
More refactoring
Modified paths:
  • /trunk/parsers/wikidom/lib/es/es.ListBlockItem.js (modified) (history)
  • /trunk/parsers/wikidom/lib/es/es.ListBlockList.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/es/es.ListBlockList.js
@@ -1,3 +1,11 @@
 2+/**
 3+ * Creates a list block list.
 4+ *
 5+ * @class
 6+ * @constructor
 7+ * @extends {es.Container}
 8+ * @param list {es.ListBlockItem} Flat list to initialize with
 9+ */
210 es.ListBlockList = function( items ) {
311 es.DomContainer.call( this, 'list', 'items', items );
412 };
@@ -2,2 +10,12 @@
311
 12+/* Static Methods */
 13+
 14+/**
 15+ * Creates a new list block list object from WikiDom data.
 16+ *
 17+ * @static
 18+ * @method
 19+ * @param wikidomList {Object} WikiDom data to convert from
 20+ * @returns {es.ListBlockList} List block list
 21+ */
422 es.ListBlockList.newFromWikiDomList = function( wikidomList ) {
@@ -8,20 +26,6 @@
927 return new es.ListBlockList( items );
1028 };
1129
12 -es.ListBlockList.prototype.renderContent = function( offset ) {
13 - for ( var i = 0; i < this.items.length; i++ ) {
14 - this.items[i].renderContent();
15 - }
16 -};
17 -
18 -es.ListBlockList.prototype.traverseItems = function( callback ) {
19 - for( var i = 0; i < this.items.length; i++ ) {
20 - if ( callback( this.items[i], i ) === false ) {
21 - return false;
22 - }
23 - }
24 -};
25 -
2630 es.ListBlockList.flattenList = function( wikidomList, items, level ) {
2731 for ( var i = 0; i < wikidomList.items.length; i++ ) {
2832 items.push(
@@ -41,4 +45,14 @@
4246 }
4347 };
4448
 49+/* Public Methods */
 50+
 51+es.ListBlockList.prototype.renderContent = function( offset ) {
 52+ // TODO: If offset is passed then render only item containing that offset
 53+ for ( var i = 0; i < this.items.length; i++ ) {
 54+ this.items[i].renderContent();
 55+ }
 56+};
 57+
 58+/* Inheritance */
4559 es.extend( es.ListBlockList, es.DomContainer );
Index: trunk/parsers/wikidom/lib/es/es.ListBlockItem.js
@@ -1,3 +1,13 @@
 2+/**
 3+ * Creates a list block item.
 4+ *
 5+ * @class
 6+ * @constructor
 7+ * @extends {es.EventEmitter}
 8+ * @param content {es.Content}
 9+ * @param style {String}
 10+ * @param level {Integer}
 11+ */
212 es.ListBlockItem = function( content, style, level ) {
313 es.EventEmitter.call( this );
414
@@ -17,6 +27,8 @@
1828 } );
1929 }
2030
 31+/* Public Methods */
 32+
2133 es.ListBlockItem.prototype.setNumber = function( number ) {
2234 this.$icon.text( number + '.' );
2335 };
@@ -37,4 +49,5 @@
3850 this.flow.render();
3951 };
4052
 53+/* Inheritance */
4154 es.extend( es.ListBlockItem, es.EventEmitter );
\ No newline at end of file

Status & tagging log