Re: Maybe we should think about Interface.isInterface functions again

On Sat, Jul 20, 2013 at 5:25 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> https://twitter.com/kuvos/status/348019487120957440 and following discussion
> has a description of such a situation arising in real-life code: the code
> wants to test for ownerDocument being non-null, but it only wants to do this
> on Node objects, of course.  And HTMLElement.prototype is one of the objects
> it ends up being passed, for whatever reason...

So why does the attribute getter in
http://dev.w3.org/2006/webapi/WebIDL/#dfn-attribute-getter throw? You
say it's because of boolean attributes. Could you give an example of
how that would go wrong? It seems like an edge case.

Having said that

% HTMLElement.prototype instanceof Node
true
%  document.body.appendChild(HTMLElement.prototype)
TypeError

does seem kind of sucky (happens across browsers, although TypeError
is not entirely consistent yet, IE throws HierarchyRequestError and
Chrome/Safari NotFoundError).


--
http://annevankesteren.nl/

Received on Saturday, 20 July 2013 16:08:50 UTC