-
-
Save broofa/1099000 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply: (Prototype.Browser.IE ? function(o, a) { | |
a = a || []; | |
switch (a.length) { | |
case 0: return this.call( o);// \ "FUUU...!" | |
case 1: return this.call( o,a[0]);// \ _ | |
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]);// \ | |
} | |
return this._apply(o, a); | |
} : Function.prototype.apply), |
just riffing on https://gist.github.com/1099000/02cd631cb52ab159e5085c82cf8e14b5a164332f
Don't recall the original rational for the ua sniff. either early versions of IE didn't support apply(), or they weren't performant .vs. call().
As I recall this was the solution to a weird error we encountered with cross-window js invocation in ie7.
apply() method didn't exist pre IE5.5 I believe. wrote that code circa 2006-2007.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
no need to ua sniff amiright? what's this for?