|
4 | 4 | <link rel="author" title="Stephen Chenney" href="mailto:schenney@chromium.org">
|
5 | 5 | <link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#highlight-cascade">
|
6 | 6 | <link rel="help" href="https://github.com/w3c/csswg-drafts/issues/6641">
|
7 |
| -<meta name="assert" content="This test verifies that custom properties used in highlight pseudos are taken from the originating element."> |
| 7 | +<meta name="assert" content="This test verifies that custom properties used in highlight pseudos are taken from the highlight and originating element."> |
8 | 8 | <script src="../support/selections.js"></script>
|
9 | 9 | <link rel="stylesheet" href="../support/highlights.css">
|
10 | 10 | <script src="/resources/testharness.js"></script>
|
11 | 11 | <script src="/resources/testharnessreport.js"></script>
|
12 | 12 | <style>
|
13 |
| - :root { |
| 13 | + body { |
14 | 14 | --background-color: green;
|
15 | 15 | --decoration-color: green;
|
16 | 16 | }
|
17 |
| - ::selection { |
| 17 | + body::selection { |
18 | 18 | --decoration-color: purple;
|
19 | 19 | }
|
20 | 20 | div::selection {
|
|
28 | 28 | <script>
|
29 | 29 | selectNodeContents(document.querySelector("body"));
|
30 | 30 |
|
| 31 | + const div_style = getComputedStyle(document.querySelector("div")); |
31 | 32 | const body_selection = getComputedStyle(document.querySelector("body"), "::selection");
|
32 | 33 | const div_selection = getComputedStyle(document.querySelector("div"), "::selection");
|
33 | 34 | test(() => void assert_equals(body_selection.getPropertyValue("--background-color"), "green"),
|
34 | 35 | "body ::selection uses the originating custom property");
|
35 |
| - test(() => void assert_equals(body_selection.getPropertyValue("--decoration-color"), "green"), |
| 36 | + test(() => void assert_equals(body_selection.getPropertyValue("--decoration-color"), "purple"), |
36 | 37 | "body ::selection does not use its own custom property");
|
37 | 38 | test(() => void assert_equals(div_selection.getPropertyValue("--decoration-color"), "green"),
|
38 | 39 | "div::selection uses the originating element custom property");
|
39 |
| - test(() => void assert_equals(div_selection.getPropertyValue("--background-color"), "green"), |
| 40 | + test(() => void assert_equals(div_selection.getPropertyValue("--background-color"), "blue"), |
40 | 41 | "div::selection does not use its own custom property");
|
| 42 | + test(() => void assert_equals(div_style.getPropertyValue("--background-color"), "green"), |
| 43 | + "div::selection properties are not present on the originating element"); |
41 | 44 | </script>
|
0 commit comments