custom-highlight-painting-staticrange-002.html (815B)
1 <!DOCTYPE html> 2 <meta charset="UTF-8"> 3 <title>CSS Highlight API Test: StaticRange 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="A StaticRange crossing a contain boundary should be painted"> 7 <style> 8 ::highlight(example-highlight) { 9 background-color: yellow; 10 color: blue; 11 } 12 #contained { 13 contain: paint; 14 } 15 </style> 16 <body><span>One <span id="contained">two </span>three…</span> 17 <script> 18 let h = new Highlight(); 19 h.add(new StaticRange({startContainer: document.body.firstChild.childNodes[0], startOffset: 0, endContainer: document.body.firstChild.childNodes[1], endOffset: 1})); 20 CSS.highlights.set("example-highlight", h); 21 </script>