Re: DOM L2 comments, various

> If instanceof(Attr) returns true, it'd better be an Attr node,
> or your users will get very confused.

I"m completely undecided as to whether that should be considered a bug or not.
It depends on an assumption about whether or not an API is a contract
guaranteeing that behavior will be supported, or stating how that behavior
behaves if this instance supports it, and I think there are legitimate design
spaces for both. Since the DOM doesn't make a statement either way, I wouldn't
count on instanceof() to distinguish node types, and I generally advise users to
avoid doing so, since there's a good alternative (nodeType) which _is_ promised
to Do The Right Thing.



______________________________________
Joe Kesselman  / IBM Research

Received on Tuesday, 5 October 1999 11:26:58 UTC