Fix issue with ensureSameOwnerDocument when parent is a document
Merge pull request #234 from arv/fix-owner-document-for-ie

Fix issue with ensureSameOwnerDocument when parent is a document