r93315 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93314‎ | r93315 | r93316 >
Date:21:18, 27 July 2011
Author:tparscal
Status:deferred
Tags:
Comment:
More refactoring and adding some functionality to to es.Range
Modified paths:
  • /trunk/parsers/wikidom/lib/es/es.Range.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/es/es.Range.js
@@ -4,8 +4,31 @@
55 * @param start {Integer} Starting point
66 * @param end {Integer} Ending point
77 * @returns {es.Range}
 8+ * @property to {Integer}
 9+ * @property from {Integer}
 10+ * @property start {Integer}
 11+ * @property end {Integer}
812 */
9 -es.Range = function( start, end ) {
10 - this.start = start || null;
11 - this.end = end || null;
 13+es.Range = function( from, to ) {
 14+ this.set( from, to );
 15+};
 16+
 17+es.Range.prototype.set = function( from, to ) {
 18+ this.from = from || 0;
 19+ this.to = to || from;
 20+ this.normalize();
1221 }
 22+
 23+es.Range.prototype.getLength = function() {
 24+ return Math.abs( this.from - this.to );
 25+};
 26+
 27+es.Range.prototype.normalize = function() {
 28+ if ( this.from < this.to ) {
 29+ this.start = this.from;
 30+ this.end = this.to;
 31+ } else {
 32+ this.start = this.to;
 33+ this.end = this.from;
 34+ }
 35+};

Status & tagging log