summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-painting-below-selection.html
blob: cd5ad36a690995607c7aedfba5a0a84e77a81fb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<!DOCTYPE html>
<meta charset="UTF-8">
<title>CSS Highlight API Test: </title>
<link rel="help" href="https://drafts.csswg.org/css-highlight-api-1/">
<link rel="match" href="custom-highlight-painting-below-selection-ref.html">
<meta name="assert" value="Highlight overlay is painted below selection overlay">
<style>
  ::highlight(foo) {
    background: cyan;
    color: blue;
  }
  ::selection {
    background: blue;
    color: cyan;
  }
</style>
<body>Text should be blue over cyan here and <span id="selected">cyan over blue here</span>.
<script>
  let highlightRange = new Range();
  highlightRange.setStart(document.body.firstChild, 0);
  highlightRange.setEnd(document.body.lastChild, 0);
  CSS.highlights.set("foo", new Highlight(highlightRange));
  getSelection().setBaseAndExtent(selected, 0, selected, 1);
</script>