- From: Cameron McCormack <cam@mcc.id.au>
- Date: Sat, 7 Mar 2009 16:48:13 +1100
- To: Ian Hickson <ian@hixie.ch>
- Cc: Boris Zbarsky <bzbarsky@MIT.EDU>, WebApps WG <public-webapps@w3.org>
Ian Hickson:
> In that case I would like us to do this (specifically, define [[Class]]
> for objects that have only one non-[NoPrototypeObject] interface), since
> that's the majority of them, and it would be better than having to
> sprinkle [PrototypeRoot] all over the place.
Done:
The value of the internal [[Class]] property of a host object is
determined as follows:
* If the host object implements a single interface, then the value
of the internal [[Class]] property MUST be the identifier of
that interface.
* Otherwise, if the host object has a primary prototype interface,
then the value of the internal [[Class]] property MUST be the
identifier of that interface.
* Otherwise, no particular value is required to be used for the
value of the internal [[Class]] property.
— http://dev.w3.org/2006/webapi/WebIDL/#host-objects
Note that this still technically does not mean you can guarantee that
the NodeList returned by querySelectorAll() has [[Class]] == "NodeList",
since it could be that that host object implements another interface,
which might be required by another spec, or perhaps just because the
implementation wants to. There’s nothing in selectors-api that says
“the object returned from querySelectorAll() must implement the NodeList
interface and no others” (and I don’t think it’d be a good idea to
require that).
--
Cameron McCormack ≝ http://mcc.id.au/
Received on Saturday, 7 March 2009 05:49:09 UTC