1. 20 Nov, 2020 15 commits
  2. 18 Nov, 2020 2 commits
    • Robert Knight's avatar
      Optimize `TextRange.toRange` if both positions are in same element · e8ed0d57
      Robert Knight authored
      Optimize the case where `toRange` is used to resolve (start, end)
      offsets within the same element by only iterating over nodes in the
      element once, instead of iterating separately to resolve the start and
      end points.
      e8ed0d57
    • Robert Knight's avatar
      Add `TextPosition.relativeTo` method · e0592c09
      Robert Knight authored
      Add a method that converts a text position within an element to one
      where the offset is relative to some ancestor element.
      
      This operation will be needed for replacing existing Range => (element,
      start, end) conversions with a single one based on `TextRange` and
      `TextPosition`.
      e0592c09
  3. 16 Nov, 2020 15 commits
  4. 13 Nov, 2020 4 commits
  5. 12 Nov, 2020 4 commits
    • Robert Knight's avatar
      Improve some JSDoc comments and a variable name · fdc5a1bd
      Robert Knight authored
      Make some small improvements in response to PR feedback.
      fdc5a1bd
    • Robert Knight's avatar
      Add more tests for splitting text nodes and fix an edge case · 5f7be6a3
      Robert Knight authored
      Add additional tests for `highlightRange` calls that requires splitting
      text nodes in order to wrap only the part inside the range. This turned
      up an edge case with handling collapsed ranges that start (and end) in
      the middle of a text node.
      5f7be6a3
    • Robert Knight's avatar
      Make `highlightRange` accept DOM range objects · bb69d03e
      Robert Knight authored
      Decouple `highlightRange` from the `NormalizedRange` class and make it
      work with ordinary DOM ranges. This decouples the highlighter
      implementation from the range wrapper types, which will make some future changes
      to highlighting easier.
      bb69d03e
    • Robert Knight's avatar
      Optimize and fix a bug in `isNodeInRange` if node had no parent · 7d196444
      Robert Knight authored
      `isNodeInRange` in range would throw an exception if the passed node had
      no parent because `range.selectNode(...)` requires its argument to have
      a parent.
      
      This commit rewrites `isNodeInRange` to use `range.comparePoint` which
      avoids creating a temporary live range and handle exceptions that
      `comparePoint` may throw. It also updates the JSDoc to more accurately
      describe what the function does.
      7d196444