summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-pseudo/selection-over-highlight-001.html
blob: 57078cf83b38e317c4c070347fe43c9e440ff6f9 (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 Pseudo-Elements Test: selected highlight highlight painting</title>
<link rel="author" name="Stephen Chenney" href="mailto:schenney@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#highlight-painting">
<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>