-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Node.parentElement should be maybe-null #11113
Comments
previousSibling, nextSibling, firstChild, lastChild... etc.. are all fair game. please feel free to send us a PR for that. You can find more information about contributing lib.d.ts fixes at https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md#contributing-libdts-fixes.
|
If they are in the DOM. It is potentially a way to identified DOM fragments and other scenarios when moving parts of the DOM about. Strict is strict, (except when it isn't |
I would defer to @kitsonk opinion on this. I do not really write a lot of DOM code, so I would have limited insight here. |
lib.dom.ts defines Node.parentElement as never-null:
https://github.com/Microsoft/TypeScript/blob/95c3eccbe9f3f7e1857ce157d437e6b80b3c9c6f/lib/lib.dom.d.ts#L8749
However, it's a pretty common pattern to write loops like
to walk up the node tree.
Also parentNode, previousSibling, nextSibling, firstChild, lastChild... (?)
The text was updated successfully, but these errors were encountered: