Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new and typeof have special behaviour on bound functions #101

Open
cpcallen opened this issue May 2, 2017 · 1 comment
Open

new and typeof have special behaviour on bound functions #101

cpcallen opened this issue May 2, 2017 · 1 comment

Comments

@cpcallen
Copy link
Collaborator

cpcallen commented May 2, 2017

The following code should return [true, true, true true] but in fact returns [true, false, false, true]:

"use strict";
function F() { /* does nothing */ };
F.prototype = {foo: "F"}
var G = F.bind(42);
G.prototype = {foo: "G"}
var f = new F();
var g = new G();
[f instanceof F, f instanceof G, g instanceof F, g instanceof G]
@NeilFraser
Copy link
Owner

Related, the bind polyfill from Mozilla is also unable to handle this:

  new (Function.prototype.bind.apply(Date, [null, 100, 200, 300, 400]));

Which should equal:

  new Date(100, 200, 300, 400)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants