Truly independent web browser
<!DOCTYPE html>
<script src="../include.js"></script>
<textarea id="area">one txet two</textarea>
<input id="text" value="quikc fox">
<input id="password" type="password" value="txet">
<input id="readonly" readonly value="txet">
<input id="disabled" disabled value="txet">
<textarea id="no-spellcheck" spellcheck="false">txet</textarea>
<div id="editable" contenteditable>Hel<b>lo</b> txet <span spellcheck="false">txet</span></div>
<div id="unfocused" contenteditable>txet</div>
<textarea id="astral">π txet</textarea>
<textarea id="long"></textarea>
<script>
promiseTest(async () => {
// Checks run only on the user's behalf, so the user focuses each field with a click.
const clickOn = (element, rect = element.getBoundingClientRect()) => internals.click(rect.left + rect.width / 2, rect.top + rect.height / 2);
document.getElementById("long").value = "word ".repeat(4000) + "txet";
const ids = ["area", "text", "password", "readonly", "disabled", "no-spellcheck", "astral", "long"];
for (const id of [...ids, "editable"]) {
clickOn(document.getElementById(id));
await internals.spellCheckSettled();
}
for (const id of ids)
println(`${id}: ${internals.spellingErrorRanges(document.getElementById(id)) || "(none)"}`);
const editable = document.getElementById("editable");
for (const node of [editable.childNodes[0], editable.childNodes[1].firstChild, editable.childNodes[2], editable.childNodes[3].firstChild])
println(`editable ${JSON.stringify(node.data)}: ${internals.spellingErrorRanges(node) || "(none)"}`);
println(`unfocused: ${internals.spellingErrorRanges(document.getElementById("unfocused").firstChild) || "(none)"}`);
});
</script>