From 366661302094d6d287ff5e3aa2300940bd3ac219 Mon Sep 17 00:00:00 2001 From: Chris Davaz Date: Fri, 14 Dec 2012 16:07:27 -0800 Subject: [PATCH] default constructor should return parent value I came across this issue with a class that caches instances when they are firste created. Subsequent calls to the constructor will return the cached instance if available. This relies on a feature of JavaScript described here: http://bclary.com/2004/11/07/#a-13.2.2 Note Step 7 in the reference document. By not returning the value from the default constructor, subclasses of Backbone classes that rely on this feature will break. --- backbone.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backbone.js b/backbone.js index 38cc9912..dc364881 100644 --- a/backbone.js +++ b/backbone.js @@ -1499,7 +1499,7 @@ if (protoProps && _.has(protoProps, 'constructor')) { child = protoProps.constructor; } else { - child = function(){ parent.apply(this, arguments); }; + child = function(){ return parent.apply(this, arguments); }; } // Add static properties to the constructor function, if supplied.