Closed mihhail-lapushkin closed 5 years ago
Thanks for the PR. Adding a check like that without understanding the underlying issue may lead to further issues, though so we can't accept the PR as-is. Also, all changes need unit tests.
If you can construct a test case, please let us know (& please open an issue in it so that we have a place to track it other than this PR).
So far I could trace it to https://github.com/jquery/jquery/blob/master/src/manipulation.js#L152 then https://github.com/jquery/jquery/blob/master/src/manipulation/buildFragment.js#L81 then https://github.com/jquery/jquery/blob/master/src/core/isAttached.js#L9
Safari inspector crashes every time I try to see the cause. Probably due to app being so huge.
I am not quite sure when it can be null, but I've observed this in our application. It happens only in Safari 12 and might be related to iframes. I am not sure if this is a good fix, but does not seem like a bad idea to protect against this case if there is a real world case suggesting document.documentElement can be null.