r102009 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102008‎ | r102009 | r102010 >
Date:17:07, 4 November 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Reorganized a few methods to reduce duplication, improved documentation
Modified paths:
  • /trunk/extensions/VisualEditor/modules/es/bases/es.DocumentNode.js (added) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/es/bases/es.DocumentNode.js
@@ -0,0 +1,44 @@
 2+/**
 3+ * Creates an es.DocumentNode object.
 4+ *
 5+ * @class
 6+ * @abstract
 7+ * @constructor
 8+ * @extends {es.EventEmitter}
 9+ */
 10+es.DocumentNode = function() {
 11+ // Inheritance
 12+ es.EventEmitter.call( this );
 13+
 14+ // Reusable function for passing update events upstream
 15+ var _this = this;
 16+ this.emitUpdate = function() {
 17+ _this.emit( 'update' );
 18+ };
 19+};
 20+
 21+/* Methods */
 22+
 23+/**
 24+ * Gets the content length.
 25+ *
 26+ * @method
 27+ * @returns {Integer} Length of content
 28+ */
 29+es.DocumentNode.prototype.getContentLength = function() {
 30+ throw 'DocumentNode.getContentLength not implemented in this subclass:' + this.constructor;
 31+};
 32+
 33+/**
 34+ * Gets the element length.
 35+ *
 36+ * @method
 37+ * @returns {Integer} Length of content
 38+ */
 39+es.DocumentNode.prototype.getElementLength = function() {
 40+ throw 'DocumentNode.getElementLength not implemented in this subclass:' + this.constructor;
 41+};
 42+
 43+/* Inheritance */
 44+
 45+es.extendClass( es.DocumentNode, es.EventEmitter );

Status & tagging log