Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<meta charset="UTF-8">
<title>CSS Highlight API Test: </title>
<link rel="match" href="custom-highlight-painting-staticrange-004-ref.html">
<meta name="assert" value="Highlight is repainted correctly after re-arranging nodes in StaticRange such that highlights go from overlapping to not">
<style>
::highlight(example-highlight) {
background-color: rgba(0, 128, 0, 0.5);
color: blue;
}
</style>
<body><span>One </span><span>one-point-five </span><span>two </span><span>three…</span>
<script>
let r1 = new StaticRange({startContainer: document.body.children[0], startOffset: 0, endContainer: document.body.children[2], endOffset: 1});
let r2 = new StaticRange({startContainer: document.body.children[1], startOffset: 0, endContainer: document.body.children[3], endOffset: 1});
CSS.highlights.set("example-highlight", new Highlight(r1,r2));
document.body.appendChild(document.body.children[1]);
document.body.appendChild(document.body.children[2]);
</script>