Treora commented on a change in pull request #88:
URL: https://github.com/apache/incubator-annotator/pull/88#discussion_r484884585



##########
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:
       > I have so far tried to only use the properties of 
[AbstractRange](https://developer.mozilla.org/en-US/docs/Web/API/AbstractRange) 
when possible
   
   Ah, I see I did not apply this in the `ownerDocument` function; I guess you 
took the approach from there.




----------------------------------------------------------------
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


Reply via email to