<!DOCTYPE html>
<script src="../../resources/run-after-layout-and-paint.js"></script>
<script>
if (window.testRunner) {
testRunner.waitUntilDone();
}
</script>
<style>
div {
width: 100px;
height: 100px;
font-size: 15px;
}
</style>
<div id="markAllSpelling">aaaaaa aaaaaa aaaaaa</div>
<div id="markNoSpelling">bbbbbb bbbbbb bbbbbb</div>
<script>
function addSpellingMarker(elem, start, end) {
const range = document.createRange();
const textNode = elem.firstChild;
range.setStart(textNode, start);
range.setEnd(textNode, end);
if (typeof internals !== 'undefined')
internals.setMarker(document, range, 'spelling');
};
function removeSpellingMarker(elem, start, end) {
const range = document.createRange();
const textNode = elem.firstChild;
range.setStart(textNode, start);
range.setEnd(textNode, end);
if (typeof internals !== 'undefined')
internals.removeMarker(document, range, 'spelling');
};
onload = runAfterLayoutAndPaint(function() {
addSpellingMarker(markAllSpelling, 0, 6);
addSpellingMarker(markAllSpelling, 14, 20);
addSpellingMarker(markNoSpelling, 0, 6);
addSpellingMarker(markNoSpelling, 14, 20);
runAfterLayoutAndPaint(function() {
removeSpellingMarker(markNoSpelling, 0, 6);
removeSpellingMarker(markNoSpelling, 14, 20);
}, true);
}, false);
</script>