1537 });
1538 // We want to make sure we pushed the listeners in the listener list rather than creating
1539 // a new one as it has already been passed to the event handlers.
1540 listeners.push.apply(listeners, moveEvent.concat(endEvent, outEvent));1541 // Text selection isn't an issue on touch devices,
1542 // so adding cursor styles can be skipped.
1543 if (event.cursor) {
Before ES2015, one must use Function.prototype.apply()
to call variadic functions.
var args = [1, 2, 3, 4];
Math.max.apply(Math, args);
In ES2015, one can use spread syntax to call variadic functions.
var args = [1, 2, 3, 4];
Math.max(...args);
foo.apply(undefined, args);
foo.apply(null, args);
obj.foo.apply(obj, args);
// Using spread syntax
foo(...args);
obj.foo(...args);
// The `this` binding is different.
foo.apply(obj, args);
obj.foo.apply(null, args);
obj.foo.apply(otherObj, args);
// The argument list is not variadic.
// Those are warned by the `no-useless-call` rule.
foo.apply(undefined, [1, 2, 3]);
foo.apply(null, [1, 2, 3]);
obj.foo.apply(obj, [1, 2, 3]);