[Pkg-javascript-commits] [backbone] 13/173: Use _.create in extend

Jonas Smedegaard dr at jones.dk
Wed Aug 31 07:43:56 UTC 2016


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

js pushed a commit to branch master
in repository backbone.

commit 3c6fabbc8fdc801cf32cf0090b7dc17f14691982
Author: Graeme Yeates <yeatesgraeme at gmail.com>
Date:   Thu Apr 2 12:27:11 2015 -0400

    Use _.create in extend
---
 backbone.js               | 11 +++--------
 bower.json                |  2 +-
 component.json            |  2 +-
 package.json              |  2 +-
 test/vendor/underscore.js |  2 +-
 5 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/backbone.js b/backbone.js
index c924965..6330ece 100644
--- a/backbone.js
+++ b/backbone.js
@@ -1856,14 +1856,9 @@
     _.extend(child, parent, staticProps);
 
     // Set the prototype chain to inherit from `parent`, without calling
-    // `parent` constructor function.
-    var Surrogate = function(){ this.constructor = child; };
-    Surrogate.prototype = parent.prototype;
-    child.prototype = new Surrogate;
-
-    // Add prototype properties (instance properties) to the subclass,
-    // if supplied.
-    if (protoProps) _.extend(child.prototype, protoProps);
+    // `parent`'s constructor function and add the prototype properties.
+    child.prototype = _.create(parent.prototype, protoProps);
+    child.prototype.constructor = child;
 
     // Set a convenience property in case the parent's prototype is needed
     // later.
diff --git a/bower.json b/bower.json
index 9cbf57b..aafb56f 100644
--- a/bower.json
+++ b/bower.json
@@ -2,7 +2,7 @@
   "name"          : "backbone",
   "main"          : "backbone.js",
   "dependencies"  : {
-    "underscore"  : ">=1.7.0"
+    "underscore"  : ">=1.8.3"
   },
   "ignore"        : ["docs", "examples", "test", "*.yml", "*.html", "*.ico", "*.md", "CNAME", ".*", "karma.*", "component.json", "package.json"]
 }
diff --git a/component.json b/component.json
index 2bcc73b..00f7371 100644
--- a/component.json
+++ b/component.json
@@ -5,7 +5,7 @@
   "keywords"      : ["model", "view", "controller", "router", "server", "client", "browser"],
   "repo"          : "jashkenas/backbone",
   "dependencies"  : {
-    "jashkenas/underscore"  : "*"
+    "jashkenas/underscore"  : ">=1.8.3"
   },
   "main"          : "backbone.js",
   "scripts"       : ["backbone.js"],
diff --git a/package.json b/package.json
index 4b79bfd..dced99e 100644
--- a/package.json
+++ b/package.json
@@ -5,7 +5,7 @@
   "keywords"      : ["model", "view", "controller", "router", "server", "client", "browser"],
   "author"        : "Jeremy Ashkenas",
   "dependencies"  : {
-    "underscore"  : ">=1.7.0"
+    "underscore"  : ">=1.8.3"
   },
   "devDependencies": {
     "coffee-script": "1.7.1",
diff --git a/test/vendor/underscore.js b/test/vendor/underscore.js
index b29332f..dfd89b2 100644
--- a/test/vendor/underscore.js
+++ b/test/vendor/underscore.js
@@ -1545,4 +1545,4 @@
       return _;
     });
   }
-}.call(this));
+}.call(this));
\ No newline at end of file

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