I think the problem is in the following code:
while ((fakedInputGetter.innerText.indexOf("\n") != -1) == false) {
fakedInputGetter.focus()
fakedInput.innerHTML = fakedInputGetter.innerText.replace("\n", "")
}
If there is no newline character found by the call to
indexOf
, then the result will be
-1
. You then compare that result (for negative equality) with
-1
. But the boolean result of
-1 != -1
is
false
. You then compare that result to be equal to
false
, which is
true
, so the while loop continues.