summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-painting-below-selection-transparency.html
blob: 886fa28f539bc30c04edf4d9adcfeb5692ae3fd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!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-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>