Replace all global document property references.

This fixes WRONG_DOCUMENT_ERR we encountered when creating a range on a Hudl 1 device, which happens when an Epub is displayed inside of an iframe.

Could not create a failing test for Chrome though.

Replacing global document with element.ownerDocument might not be
required in all cases, but better to be on the safe side.

Related to #8.