 = rect.top + rect.height / 2;
    const caretPosition = document.caretPositionFromPoint(x, y);
    assert_true(caretPosition instanceof CaretPosition);
    assert_true(caretPosition.offsetNode instanceof Text);
    assert_equals(typeof(caretPosition.offset), "number");
    assert_equals(caretPosition.offsetNode, textDiv.firstChild);
    assert_equals(caretPosition.offset, characterIndex);
  }, "document.caretPositionFromPoint() should return a CaretPosition at the specified location");

  test(() => {
    