Closed tilgovi closed 9 years ago
The built-in method has bugs in many not-the-latest-version browsers. I'm fine to export it when available (I'd like to eventually update this module to conform to the es-shim API) but that requires including all of the relevant tests for every version of every JS engine that ever existed, which isn't a small task to gather up.
That's nice. Thanks for the link to es-shim. I like it.
The issue I have right now is that I'm inheriting this as a transitive dependency in my application and the use of the Function
function violates the eval restriction I have from CSP.
So, I'm trying to figure out what I can do to help resolve that.
I take it there are good reasons for that invocation. Maybe for stringification, or .length
support or something?
It's required for .length
support, yes.
So, for CSP, even if this module also returned the native, CSP would still error out - so that's not going to be a solution.
Alright, I'm going to tackle this by removing the dependency further up the chain. Feel free to close this or keep it open as a place for the es-shim work. Thanks for your feedback.
Thanks, I'll close it.
Please do tag me on where you remove the dependency - removing ES3 compatibility for CSP is a pretty serious tradeoff in reusable code. You may be able to resolve it by making a fake "function-bind" module in the root of your node_modules
that has a package.json
and exports Function.prototype.bind
, such that npm
simply won't install it - then you've simply overridden this module with your own without having to make any other changes.
What do people think of exporting
Function.prototype.bind
if it exists?