custom-highlight-painting-013.html (855B)
1 <!DOCTYPE html> 2 <meta charset="UTF-8"> 3 <title>CSS Highlight API Test: </title> 4 <link rel="help" href="https://drafts.csswg.org/css-highlight-api-1/"> 5 <link rel="match" href="custom-highlight-painting-001-ref.html"> 6 <meta name="assert" value="Highlight is repainted correctly after modifying text content of a node included in a Range contained in it"> 7 <style> 8 ::highlight(example-highlight) { 9 background-color: yellow; 10 color: blue; 11 } 12 </style> 13 <body><span id="first">One </span><span id="second">two-point-five </span><span id="third">three…</span> 14 <script> 15 let r = new Range(); 16 r.setStart(document.querySelector("#first").firstChild, 0); 17 r.setEnd(document.querySelector("#third").firstChild, 0); 18 CSS.highlights.set("example-highlight", new Highlight(r)); 19 document.querySelector("#second").firstChild.textContent = "two "; 20 </script>