Browse files

Merge pull request #1571 from aeosynth/master

use inherits helper directly
  • Loading branch information...
2 parents a8cf11e + 4c6f192 commit ab98b91ad97c9a1af3fa50664ae37274861dd94e @jashkenas committed Aug 21, 2012
Showing with 5 additions and 9 deletions.
  1. +5 −9 backbone.js
View
14 backbone.js
@@ -1314,14 +1314,6 @@
});
- // The self-propagating extend function that Backbone classes use.
- var extend = function(protoProps, classProps) {
- return inherits(this, protoProps, classProps);
- };
-
- // Set up inheritance for the model, collection, and view.
- Model.extend = Collection.extend = Router.extend = View.extend = extend;
-
// Backbone.sync
// -------------
@@ -1421,7 +1413,8 @@
// Helper function to correctly set up the prototype chain, for subclasses.
// Similar to `goog.inherits`, but uses a hash of prototype properties and
// class properties to be extended.
- var inherits = function(parent, protoProps, staticProps) {
+ var extend = function(protoProps, staticProps) {
+ var parent = this;
var child;
// The constructor function for the new subclass is either defined by you
@@ -1457,6 +1450,9 @@
return child;
};
+ // Set up inheritance for the model, collection, and view.
+ Model.extend = Collection.extend = Router.extend = View.extend = extend;
+
// Helper function to get a value from a Backbone object as a property
// or as a function.
var getValue = function(object, prop) {

0 comments on commit ab98b91

Please sign in to comment.