Merge pull request #1924 from spicyj/autobind-bind

Use .bind when autobinding
This commit is contained in:
Cheng Lou
2014-07-25 01:34:15 -07:00
2 changed files with 2 additions and 4 deletions
+1 -3
View File
@@ -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;
@@ -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() {