[Pkg-javascript-commits] [backbone] 09/34: expand inherits helper child constructor creation, for clarity.

Jonas Smedegaard js at moszumanska.debian.org
Sat May 3 16:58:44 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag 0.1.2
in repository backbone.

commit 9c535ca5a55fa2003146270e745258415b6083a4
Author: Jeremy Ashkenas <jashkenas at gmail.com>
Date:   Thu Oct 14 13:31:19 2010 -0400

    expand inherits helper child constructor creation, for clarity.
---
 backbone.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/backbone.js b/backbone.js
index 4d1a6c4..064b497 100644
--- a/backbone.js
+++ b/backbone.js
@@ -31,8 +31,12 @@
   // Similar to `goog.inherits`, but uses a hash of prototype properties and
   // class properties to be extended.
   var inherits = function(parent, protoProps, classProps) {
-    var child = protoProps.hasOwnProperty('constructor') ? protoProps.constructor :
-                function(){ return parent.apply(this, arguments); };
+    var child;
+    if (protoProps.hasOwnProperty('constructor')) {
+      child = protoProps.constructor;
+    } else {
+      child = function(){ return parent.apply(this, arguments); };
+    }
     var ctor = function(){};
     ctor.prototype = parent.prototype;
     child.prototype = new ctor();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/backbone.git



More information about the Pkg-javascript-commits mailing list