mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
use .apply instead of .call in ReactCompositeComponent
This was a bit ridiculous.. let's just use arguments as it's supposed to be used.
This commit is contained in:
committed by
Paul O’Shannessy
parent
15272f30f4
commit
ca19ffb083
@@ -398,13 +398,9 @@ function mixSpecIntoComponent(Constructor, spec) {
|
||||
* @private
|
||||
*/
|
||||
function createChainedFunction(one, two) {
|
||||
return function chainedFunction(a, b, c, d, e, f, g, tooMany) {
|
||||
invariant(
|
||||
typeof tooMany === 'undefined',
|
||||
'Chained function can only take a maximum of 7 arguments.'
|
||||
);
|
||||
one.call(this, a, b, c, d, e, f, g);
|
||||
two.call(this, a, b, c, d, e, f, g);
|
||||
return function chainedFunction() {
|
||||
one.apply(this, arguments);
|
||||
two.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -833,14 +829,9 @@ var ReactCompositeComponentMixin = {
|
||||
*/
|
||||
_bindAutoBindMethod: function(method) {
|
||||
var component = this;
|
||||
function autoBound(a, b, c, d, e, f, g, tooMany) {
|
||||
invariant(
|
||||
typeof tooMany === 'undefined',
|
||||
'React.autoBind(...): Methods can only take a maximum of 7 arguments.'
|
||||
);
|
||||
return method.call(component, a, b, c, d, e, f, g);
|
||||
}
|
||||
return autoBound;
|
||||
return function() {
|
||||
return method.apply(component, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user