W3C home > Mailing lists > Public > public-webapi@w3.org > March 2008

Re: Resp.: [Bindings] What does typeof return for interface objects?

From: Cameron McCormack <cam@mcc.id.au>
Date: Wed, 19 Mar 2008 10:21:52 +1100
To: "Web APIs WG (public)" <public-webapi@w3.org>
Message-ID: <20080318232152.GB22818@arc.mcc.id.au>

Hi João.

João Eiras:
> It does not make sense to be only an object, because you can only have
> instances of functions and the instanceof operator requires a function
> on the right hand side. That ff3 thing might be a regression.

That’s not true.  This is what ECMA-262 says the behaviour of
‘RelationalExpression instanceof ShiftExpression’ should be:

  1. Evaluate RelationalExpression.
  2. Call GetValue(Result(1)).
  3. Evaluate ShiftExpression.
  4. Call GetValue(Result(3)).
  5. If Result(4) is not an object, throw a TypeError exception.
  6. If Result(4) does not have a [[HasInstance]] method, throw a
     TypeError exception.
  7. Call the [[HasInstance]] method of Result(4) with parameter
     Result(2).
  8. Return Result(7).

So all that is needed for something like ‘document instanceof
HTMLDocument’ to work is for the HTMLDocument interface object to
implement [[HasInstance]] (which is what section 4.2.1.1 requires).

Cameron

-- 
Cameron McCormack, http://mcc.id.au/
	xmpp:heycam@jabber.org  ▪  ICQ 26955922  ▪  MSN cam@mcc.id.au
Received on Tuesday, 18 March 2008 23:22:25 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 18 March 2008 23:22:27 GMT