resize-detector
resize-detector copied to clipboard
Cope with null document
This can happen in unit tests, especially when using Jest with jsdom.
You may get warnings like:
Cannot log after tests are done. Did you forget to wait for something async in your test?
Attempted to log "Error: Uncaught [TypeError: Cannot read property 'documentElement' of null]
If we check for the existence of the document first, we can tidy up our test output.