Treora commented on a change in pull request #88: URL: https://github.com/apache/incubator-annotator/pull/88#discussion_r484880916
########## File path: packages/dom/src/highlight-range.ts ########## @@ -73,8 +73,9 @@ function textNodesInRange(range: Range): Text[] { } // Collect the text nodes. - const document = - range.startContainer.ownerDocument || (range.startContainer as Document); + const { commonAncestorContainer } = range; + const { ownerDocument } = commonAncestorContainer; + const document = ownerDocument ?? (commonAncestorContainer as Document); Review comment: Also, these exact lines appear in several places; I’d prefer to just keep the `ownerDocument` helper to hide this implementation detail. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org