Added some more null safety
Added some more null safety

For cases where the node is not null, but the node has no parent (it has been
detached from the document).  Probably need to write some unit tests for these...

jasononeil/detox,jasononeil/detox,jasononeil/detox