r93316 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93315‎ | r93316 | r93317 >
Date:21:26, 27 July 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Cleanup
Modified paths:
  • /trunk/parsers/wikidom/lib/es/es.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/es/es.js
@@ -5,8 +5,10 @@
66 */
77 var es = {};
88
 9+/* Functions */
 10+
911 /**
10 - * Extends a constructor with prototype of another.
 12+ * Extends a constructor with the prototype of another.
1113 *
1214 * When using this, it's required to include a call to the constructor of the parent class as the
1315 * first code in the child class's constructor.
@@ -14,6 +16,7 @@
1517 * @example
1618 * // Define parent class
1719 * function Foo() {
 20+ * // code here
1821 * }
1922 * // Define child class
2023 * function Bar() {
@@ -23,16 +26,14 @@
2427 * // Extend prototype
2528 * extend( Bar, Foo );
2629 *
27 - * @param dst {Function} Class to copy prototype members to
28 - * @param src {Function} Class to copy prototype members from
 30+ * @param dst {Function} Class to extend
 31+ * @param src {Function} Base class to use methods from
2932 */
3033 es.extend = function( dst, src ) {
3134 var base = new src();
32 - var i; // iterator
33 -
34 - for ( i in base ) {
35 - if ( typeof base[i] === 'function' && !( i in dst.prototype ) ) {
36 - dst.prototype[i] = base[i];
 35+ for ( var method in base ) {
 36+ if ( typeof base[method] === 'function' && !( method in dst.prototype ) ) {
 37+ dst.prototype[method] = base[method];
3738 }
3839 }
3940 }

Status & tagging log