Open LongTengDao opened 5 years ago
When I overwrite Function.prototype.bind
in my current browser with the shim's implementation, new f instanceof b
returns true for me. In what browser are you seeing it return false?
(Note that it would be incorrect to set it directly; b.prototype !== f.prototype
in native)
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="./es5-shim.js"></script>
</head>
<body>
<script>
function F () {}
var B = F.bind([]);
var f = new F;
document.write(f instanceof B);
</script>
</body>
</html>
IE 6 7 8 all print false
.
In current shim, B.prototype
is instance of F
, in other words, new F
and B.prototype
are same level instance.
(! ( B.prototype instanceof F )
in native too)
https://github.com/es-shims/es5-shim/blob/d5297adf9a9ca5669b3d43153fa2d8092e879f9c/es5-shim.js#L307