mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Merge pull request #1924 from spicyj/autobind-bind
Use .bind when autobinding
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user