r92776 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92775‎ | r92776 | r92777 >
Date:19:05, 21 July 2011
Author:inez
Status:deferred
Tags:
Comment:
Change the way how Document and Blocks are initialized. Implement many static class constructors.
Modified paths:
  • /trunk/parsers/wikidom/lib/es/es.Block.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/es/es.Block.js
@@ -7,6 +7,21 @@
88 this.document = null;
99 }
1010
 11+/**
 12+ * Association between block type name and block class
 13+ * Example: "paragraph" => es.ParagraphBlock
 14+ *
 15+ */
 16+es.Block.models = {};
 17+
 18+es.Block.newFromWikidom = function( wikidomBlock ) {
 19+ if ( wikidomBlock.type in es.Block.models ) {
 20+ return es.Block.models[wikidomBlock.type].newFromWikidom( wikidomBlock );
 21+ } else {
 22+ throw 'Unknown block type: ' + wikidomBlock.type;
 23+ }
 24+};
 25+
1126 es.Block.prototype.getLength = function() {
1227 throw 'Block.getLength not implemented in this subclass.';
1328 };

Status & tagging log