User:Krinkle/Extension review/InlineCategorizer

Prequel

 * Originally written by mdale in the JS2 branch at
 * Also authored by werdna, who added it to mediawiki core in . Which was then removed by tstartling in to be further worked on in the js2-work branch
 * In diebuche brought ajaxcategories.js back from trunk from before tstartling removed it.  (log)
 * Hm.. perhaps it should've been copied from  instead , the branch seems to have a more recent version!
 * After several larger and smaller reviews by catrope and krinkle
 * See CR: Special:Code/MediaWiki/93351, ..
 * .. it was removed again from trunk into an extension by krinkle, because there is simply too much work to be done and the code base is not near acceptable for core, yet.

This page serves as a planning page for this module.
 * What are the requirements
 * Proposals for implementations.
 * Do we start from scratch ? Or from /branches/js2-work/phase3/js/ ? Or from the rewrite that diebuche and krinkle did in early 2011 ?
 * Currently the latter is taken as starting point in the extensions directory.

Object oriented model
There seems to be little to no separation between general logic and the user interface events. The only way to property perform actions is by triggering native events. Also the code extracts information about the current active state on the contents of the DOM (instead of having a local object with the properties and keeping that in sync with the frontend).

The proposed solution would be to split the module up into two parts. An API object with methods and a UI object with methods. The API object methods are called from the event handlers in the UI methods, but can also be called directly (ie. by other gadgets or by unit tests). And, of course, not a single call should be made from an API method to a UI method. Connection between the two works through callbacks.

A short sample / proposal (could be moved to a subpage for wiki-programming)

Parser
Right now it understands and avoids -tags and   to some degree, but it doesn't handle  -tags yet.