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.

Luke

-----Original Message-----
From: [email protected] [mailto:[email protected]] On 
Behalf Of John-David Dalton
Sent: Tuesday, August 16, 2011 7:27 AM
To: [email protected]
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.
http://es5.github.com/#x15.3.4.5.2
http://es5.github.com/#x15.3.4.5.3

~~~ 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?

-JDD
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to