Created
March 28, 2014 05:29
-
-
Save imaya/9825990 to your computer and use it in GitHub Desktop.
PhantomJS で String.fromCharCode.apply の第二引数に Typed Array を渡すとバグるのを回避
This file contains hidden or 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
if (window.Uint8Array !== void 0) { | |
try { | |
String.fromCharCode.apply(null, new Uint8Array([0])); | |
} catch(e) { | |
String.fromCharCode.apply = (function(fromCharCodeApply) { | |
return function(thisobj, args) { | |
return fromCharCodeApply.call(String.fromCharCode, thisobj, Array.prototype.slice.call(args)); | |
} | |
})(String.fromCharCode.apply); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment