svg-text-selection-fill-only.html (939B)
1 <!DOCTYPE html> 2 <title>CSS Pseudo-Elements Test: ::selection with fill only for SVG </title> 3 <link rel="author" title="Stephen Chenney" href="mailto:schenney@chromium.org"> 4 <link rel="help" href="https://drafts.csswg.org/css-pseudo/#selectordef-selection"> 5 <meta name="assert" content="Verify that ::selection with only fill specified uses selection fill and originating stroke."> 6 <link rel="match" href="reference/svg-text-selection-ref.html"> 7 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> 8 <script src="support/selections.js"></script> 9 <style> 10 div { 11 font: 16px Ahem; 12 } 13 text { 14 fill: red; 15 stroke: darkgreen; 16 } 17 ::selection { 18 background-color: transparent; /* Avoid default background color. */ 19 fill: lightgreen; 20 } 21 </style> 22 <div> 23 <svg width="100" height="60"> 24 <text x="20" y="20">Text to select</text> 25 </svg> 26 </div> 27 <script>selectNodeContents(document.querySelector("div"));</script>