Closed devrelm closed 6 years ago
@devrelm Throwing a TypeError is the correct behavior. The convention you are referring to in this case can be seen in the WebIDL spec where we try to convert something to an interface. Note in step 1, Type(target)
will not return Object
in the case where target
is null
or undefined
so we'll be caught red-handed here :)
Let me know if that makes sense or needs more clarification!
Thanks, that is very informative! I had never looked at the IDL spec and so never realized that it was defined so thoroughly.
What should be the behavior when passing
null
orundefined
tounobserve()
?The spec does not define one way or another (unless there's a wider convention/context that I've missed.)
Chrome's implementation currently throws an error if the first argument is not an
Element
.There are no tests (in this repo) defining this behavior, either.