Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<meta charset="UTF-8">
<title>CSS Highlight API Test: no trailing whitespace painted at line wrap</title>
<link rel="match" href="custom-highlight-painting-line-wrap-001-ref.html">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
<meta name="assert" value="Highlight backgrounds must not extend over trailing whitespace at line breaks.">
<style>
div {
font: 16px/1 Ahem;
width: 100px;
}
::highlight(test) {
background-color: green;
}
</style>
<body>
<div id="d">one two three four five six seven eight nine ten</div>
<script>
const text = document.getElementById("d").firstChild;
const r = new Range();
r.setStart(text, 0);
r.setEnd(text, text.length);
CSS.highlights.set("test", new Highlight(r));
</script>