caret-color-016

caret-color visited link computed value

WeasyPrint

This browser

Flags
interact, may, script
Assertion
Test checks that computed style of caret-color on visited links doesn't leak privacy information.

Source

 1 <!DOCTYPE html>
 2 <html><head><meta charset="utf-8">
 3 <title>CSS Basic User Interface Test: caret-color visited link computed value</title>
 4 <link href="mailto:rego@igalia.com" rel="author" title="Manuel Rego Casasnovas">
 5 <link href="http://www.w3.org/TR/css3-ui/#caret-color" rel="help">
 6 <link href="https://www.w3.org/TR/css3-color/#color0" rel="help">
 7 <link href="https://www.w3.org/TR/selectors4/#link" rel="help">
 8 <meta content="may interact" name="flags">
 9 <meta content="Test checks that computed style of caret-color on visited links doesn't leak privacy information." name="assert">
10 <script src="/resources/testharness.js"></script>
11 <script src="/resources/testharnessreport.js"></script>
12 <style>
13   a {
14     font-size: 3em;
15     font-weight: bold;
16     width: 10em;
17     padding: 10px;
18     background: black; /* the color of a thin object like the caret is easier to see on a black background. */
19 
20     color: white;
21     caret-color: lime;
22   }
23 
24   a:link {
25     color: yellow;
26   }
27 
28   a:visited {
29     caret-color: cyan;
30   }
31 </style>
32 </head><body>
33   <p>Before running this test, this <a href="./">link</a> must have been visited. It will have yellow text if this is not the case. If it its text is yellow, you need to navigate to this link first.
34   </p><p><a href="./" contenteditable="" id="link">link</a></p>
35   <div id="log"></div>
36 
37   <script>
38     setup(
39       function(){
40         /* Helper to get the link into the browsing history.
41            Using a relative path because some browsers only allow replaceState within the same domain. */
42         current_url = window.location.href;
43         history.replaceState({},"","./");
44         history.replaceState({},"",current_url);
45       });
46 
47     test(
48       function(){
49         var link = document.getElementById("link");
50         assert_equals(window.getComputedStyle(link)["caret-color"], "rgb(0, 255, 0)");
51     }, "The computed value of a visited link should be the same than a non-visited link");
52   </script>
53 
54 </body></html>