tart = words.length - 1; start >= 0; start--)
        if (words[start] == " " || words[start] == "\xA0")
          break;

      try {
        const range = createRange(main, start == -1 ? 0 : start + 1, end);
        internals.setMarker(document, range, "spelling");
      } catch (_) {
        /* empty */
      }
    }
  }

  setupTest();

  measurePaint({
    description: "Measure frame time for typing in contenteditable with many spelling errors",
    run: () => void simulateTyping(),
  });
</script>
