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-below-selection-transparency-ref.html">
<meta name="assert"
value="Highlight overlay is painted below selection overlay. If selection uses transparency, colors are combined.">
<style>
::highlight(foo) {
background: yellow;
}
</style>
<body><span id="highlighted">This should be yellow, <span id="selected">this should mix with the
selection,</span></span> this should have no background.
<script>
let highlightRange = new Range();
highlightRange.setStart(document.body.firstChild, 0);
highlightRange.setEnd(document.body.firstChild, 2);
CSS.highlights.set("foo", new Highlight(highlightRange));
getSelection().setBaseAndExtent(selected, 0, selected, 1);
</script>