add support for ownerDocument

this adds support and tests for ownerDocument