Closed manyuemeiquqi closed 1 year ago
In ES3 is impossible to make a completely correct Function.prototype.bind
polyfill.
The spec requires that the result hasn't a .prototype
property at all - but it can't be removed from usual functions; IIRC in some engines it can be only an object.
Also, should work
function F() { /* empty */ }
var B = F.bind();
new F() instanceof B; // should be true
and some other such moments.
So the current approach is not completely correct by the spec, but I don't see a way how to do it better.
When view bind polyfill, i think this line code should judge. e.g.
The polyfill current will cause bindFunction has prototye whenever.