So here is a philosophical question.
In TypeScript a ChildNode can be parentless, since both ChildNode.parentElement
and ChildNode.parentNode
have a null
type option.
But being ChildNode wouldn't it, by the nature of it, have a parent? I can understand that parentElement
might be null
, since it might derive from a non element node (or would that even be possible) but shouldn't at least parentNode
be non-null?
I understand that it is not really specifically indicated in the DOM spec, but wouldn't it be strange to have a ChildNode
with no parent?
Is it like this in the case that you might move the node away from the parent? But wouldn't something like this change the type of the ChildNode
, to plain ol' Node
?
I would be really interested in having your insight on this question, as it has left me a bit puzzled.