diff --git a/src/core/ReactCompositeComponent.js b/src/core/ReactCompositeComponent.js index 637c6613a0..42a1dcb45b 100644 --- a/src/core/ReactCompositeComponent.js +++ b/src/core/ReactCompositeComponent.js @@ -1265,9 +1265,7 @@ var ReactCompositeComponentMixin = { */ _bindAutoBindMethod: function(method) { var component = this; - var boundMethod = function() { - return method.apply(component, arguments); - }; + var boundMethod = method.bind(component); if (__DEV__) { boundMethod.__reactBoundContext = component; boundMethod.__reactBoundMethod = method; diff --git a/src/core/__tests__/ReactCompositeComponentError-test.js b/src/core/__tests__/ReactCompositeComponentError-test.js index 587ebe53f1..049af8a37c 100644 --- a/src/core/__tests__/ReactCompositeComponentError-test.js +++ b/src/core/__tests__/ReactCompositeComponentError-test.js @@ -26,7 +26,7 @@ var ReactErrorUtils = require('ReactErrorUtils'); describe('ReactCompositeComponent-error', function() { it('should be passed the component and method name', function() { - spyOn(ReactErrorUtils, 'guard'); + spyOn(ReactErrorUtils, 'guard').andCallThrough(); var Component = React.createClass({ someHandler: function() {}, render: function() {