Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!doctype html>
<meta charset="utf-8">
<title>CSS Pseudo-Elements Test: selected highlight highlight painting</title>
<link rel="author" name="Stephen Chenney" href="mailto:schenney@igalia.com">
<meta name="assert" value="Checks that the highlight colors persist when selected.">
<link rel="match" href="selection-over-highlight-001-ref.html">
<style>
::selection {
background-color: lightblue;
}
::highlight(green) {
color: green;
}
</style>
<div id="content">When selected, the highlight color should remain.</div>
<script>
let range = new Range();
range.setStart(content, 0);
range.setEnd(content, 1);
CSS.highlights.set("green", new Highlight(range));
document.execCommand("selectAll");
</script>