| <!doctype html> |
| <meta charset="utf-8"> |
| <title>CSS Pseudo-Elements Test: interactions between ::selection and text-decoration</title> |
| <link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#highlight-painting"> |
| <link rel="help" href="https://drafts.csswg.org/css-text-decor-4/#painting"> |
| <link rel="help" href="https://www.w3.org/TR/CSS22/zindex.html#painting-order"> |
| <link rel="match" href="selection-decoration-p3-ref.html"> |
| <meta name="assert" value="originating decorations on unselected parts are in originating text-decoration-color, even when some of the text is selected"> |
| <script src="support/selections.js"></script> |
| <link rel="stylesheet" href="support/highlights.css"> |
| <link rel="stylesheet" href="/fonts/ahem.css"> |
| <style> |
| /* |
| This test verifies that the originating decoration is not |
| recolored in the unselected parts. |
| |
| Chromium fails this test before /c/2903387. |
| */ |
| main { |
| font: 7em Ahem; |
| margin: 0.5em; |
| width: min-content; |
| text-decoration: 0.125em green solid line-through; |
| } |
| main::selection { |
| background: transparent; |
| } |
| </style> |
| <p>Test passes if the line-through decoration has two green ends. |
| <main class="highlight_reftest">ppppp</main> |
| <script> |
| const target = document.querySelector("main"); |
| selectRangeWith(range => { |
| range.selectNodeContents(target); |
| range.setStart(target.childNodes[0], 1); |
| range.setEnd(target.childNodes[0], 4); |
| }); |
| </script> |