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 ); |