Skip to content

Instantly share code, notes, and snippets.

@joestelmach
Created July 22, 2011 04:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save joestelmach/1098911 to your computer and use it in GitHub Desktop.
Save joestelmach/1098911 to your computer and use it in GitHub Desktop.
apply: (Prototype.Browser.IE ? function(o, a) {
a = a || [];
switch (a.length) {
case 0: return this.call( o);
case 1: return this.call( o, a[0]);// shreddin' the argument powder
case 2: return this.call( o, a[0], a[1]);// \__O_/
case 3: return this.call( o, a[0], a[1], a[2]);// |
case 4: return this.call( o, a[0], a[1], a[2], a[3]);// \ /\
case 5: return this.call( o, a[0], a[1], a[2], a[3], a[4]);// \ /
case 6: return this.call( o, a[0], a[1], a[2], a[3], a[4], a[5]);// \
case 7: return this.call( o, a[0], a[1], a[2], a[3], a[4], a[5], a[6]);
case 8: return this.call( o, a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7]);
case 9: return this.call( o, a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]);
case 10: return this.call( o, a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9]);
case 11: return this.call( o, a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10]);
case 12: return this.call( o, a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11]);
case 13: return this.call( o, a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12]);
case 14: return this.call( o, a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13]);
case 15: return this.call( o, a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14]);
case 16: return this.call( o, a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]);
case 17: return this.call( o, a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15], a[16]);
case 18: return this.call( o, a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15], a[16], a[17]);
case 19: return this.call( o, a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15], a[16], a[17], a[18]);
case 20: return this.call( o, a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15], a[16], a[17], a[18], a[19]);
case 21: return this.call( o, a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15], a[16], a[17], a[18], a[19], a[20]);
case 22: return this.call( o, a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15], a[16], a[17], a[18], a[19], a[20], a[21]);
case 23: return this.call( o, a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15], a[16], a[17], a[18], a[19], a[20], a[21], a[22]);
case 24: return this.call( o, a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15], a[16], a[17], a[18], a[19], a[20], a[21], a[22], a[23]);
case 25: return this.call( o, a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15], a[16], a[17], a[18], a[19], a[20], a[21], a[22], a[23], a[24]);
}
return this._apply(o, a);
} : Function.prototype.apply),
@broofa
Copy link

broofa commented Jul 22, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment