https://www.mediawiki.org/wiki/Special:Code/MediaWiki/102009
Revision: 102009
Author: tparscal
Date: 2011-11-04 17:07:34 +0000 (Fri, 04 Nov 2011)
Log Message:
-----------
Reorganized a few methods to reduce duplication, improved documentation
Added Paths:
-----------
trunk/extensions/VisualEditor/modules/es/bases/es.DocumentNode.js
Added: trunk/extensions/VisualEditor/modules/es/bases/es.DocumentNode.js
===================================================================
--- trunk/extensions/VisualEditor/modules/es/bases/es.DocumentNode.js
(rev 0)
+++ trunk/extensions/VisualEditor/modules/es/bases/es.DocumentNode.js
2011-11-04 17:07:34 UTC (rev 102009)
@@ -0,0 +1,44 @@
+/**
+ * Creates an es.DocumentNode object.
+ *
+ * @class
+ * @abstract
+ * @constructor
+ * @extends {es.EventEmitter}
+ */
+es.DocumentNode = function() {
+ // Inheritance
+ es.EventEmitter.call( this );
+
+ // Reusable function for passing update events upstream
+ var _this = this;
+ this.emitUpdate = function() {
+ _this.emit( 'update' );
+ };
+};
+
+/* Methods */
+
+/**
+ * Gets the content length.
+ *
+ * @method
+ * @returns {Integer} Length of content
+ */
+es.DocumentNode.prototype.getContentLength = function() {
+ throw 'DocumentNode.getContentLength not implemented in this subclass:'
+ this.constructor;
+};
+
+/**
+ * Gets the element length.
+ *
+ * @method
+ * @returns {Integer} Length of content
+ */
+es.DocumentNode.prototype.getElementLength = function() {
+ throw 'DocumentNode.getElementLength not implemented in this subclass:'
+ this.constructor;
+};
+
+/* Inheritance */
+
+es.extendClass( es.DocumentNode, es.EventEmitter );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs