@samitouri / QOS-React-2 / commits / ca19ffb083
Fork 0

The library for web and native user interfaces.

use .apply instead of .call in ReactCompositeComponent

This was a bit ridiculous.. let's just use arguments as it's supposed to be used.

CommitSyncScript committed Jun 28, 2013 at 16:34 UTC ca19ffb0837bd9211375b77e589fcc40f658c34e
1 file changed +6 -15
src/core/ReactCompositeComponent.js
+6 -15
@@ -398,13 +398,9 @@ function mixSpecIntoComponent(Constructor, spec) {
398 * @private
399 */
400 function createChainedFunction(one, two) {
401 - return function chainedFunction(a, b, c, d, e, f, g, tooMany) {
402 - invariant(
403 - typeof tooMany === 'undefined',
404 - 'Chained function can only take a maximum of 7 arguments.'
405 - );
406 - one.call(this, a, b, c, d, e, f, g);
407 - two.call(this, a, b, c, d, e, f, g);
401 + return function chainedFunction() {
402 + one.apply(this, arguments);
403 + two.apply(this, arguments);
404 };
405 }
406
@@ -833,14 +829,9 @@ var ReactCompositeComponentMixin = {
829 */
830 _bindAutoBindMethod: function(method) {
831 var component = this;
836 - function autoBound(a, b, c, d, e, f, g, tooMany) {
837 - invariant(
838 - typeof tooMany === 'undefined',
839 - 'React.autoBind(...): Methods can only take a maximum of 7 arguments.'
840 - );
841 - return method.call(component, a, b, c, d, e, f, g);
842 - }
843 - return autoBound;
832 + return function() {
833 + return method.apply(component, arguments);
834 + };
835 }
836
837 };