summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-pseudo/highlight-painting-currentcolor-005.html
blob: f5c15aafa99ac5b068bbf267bb8ea3583d7ba79a (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!DOCTYPE html>
<meta charset="utf-8" />
<title>CSS Pseudo-Elements Test: Custom Highlights currentcolor on visited</title>
<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-pseudo/#highlight-text">
<meta name="assert" content="Checks that color currentcolor is properly resolved when painting highlight pseudos on a visited link.">
<link rel="match" href="highlight-painting-currentcolor-005-ref.html">
<link rel="stylesheet" href="support/highlights.css">
<style>
a {
  color: green;
  text-decoration: none;
}
a:visited {
  color: blue;
}
a::highlight(example) {
  color: currentcolor;
}
a:visited::highlight(example) {
  color: currentcolor;
}
</style>
<a href="" class="highlight_reftest">visited</a>
<a href="unvisited" class="highlight_reftest">unvisited</a>

<script>
  function range(node, start, end) {
    let range = new Range();
    range.setStart(node, start);
    range.setEnd(node, end);
    return range;
  }

  const links = document.getElementsByTagName("a");
  let ranges = [];
  for (let link of links) {
    ranges.push(range(link, 0, 1));
  }
  CSS.highlights.set("example", new Highlight(...ranges));
</script>