Function#bind [[HasInstance]] question.

Luke Hoban lukeh at
Tue Aug 16 09:12:10 PDT 2011

My interpretation of these spec sections:

(new bound) instanceof bound
=> (new Bar()) instanceof bound // bind's Construct defers to the targetFunction and ignores bound thisValue
=> bound.[[HasInstance]](new Bar()) // meaning of instanceof
=> Bar.[[HasInstance]](new Bar()) // bind's HasInstance defers to the targetFunction
=> true // normal HasInstance 

Similarly for 'new bound instanceof Bar'.    IE and Firefox both appear to agree with this result.


-----Original Message-----
From: es-discuss-bounces at [mailto:es-discuss-bounces at] On Behalf Of John-David Dalton
Sent: Tuesday, August 16, 2011 7:27 AM
To: es-discuss at
Subject: Function#bind [[HasInstance]] question.

Sorry about the last empty reply, GMail got ahead of itself :D

So Chrome and Firefox disagree on their Function#bind implementation.

~~~ js
function Bar() {
  return 1;
var bound = Bar.bind({});
new bound instanceof bound; // Firefox reports `true`, Chrome `false` (I think Chrome is right) new bound instance of Bar; // Firefox and Chrome report `true` ~~~

The test262 doesn't appear to cover this case.
What is the correct result of `new bound instance of bound;` and why?

es-discuss mailing list
es-discuss at

More information about the es-discuss mailing list