custom-highlight-painting-018.html (794B)
1 <!DOCTYPE html> 2 <meta charset="UTF-8"> 3 <title>CSS Highlight API Test: Range across contain boundary is painted</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 should be painted even though a Range that crosses a css-contain boundary is a part of it"> 7 <style> 8 ::highlight(example-highlight) { 9 background-color: yellow; 10 color: blue; 11 } 12 #target { 13 contain: paint; 14 } 15 </style> 16 <body><span>One </span><span id="target"><span>two </span><span>three…</span></span> 17 <script> 18 let r = new Range(); 19 r.setStart(document.body, 0); 20 r.setEnd(document.querySelector("#target"), 1); 21 CSS.highlights.set("example-highlight", new Highlight(r)); 22 </script>