custom-highlight-painting-014.html (749B)
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="Registering the same Highlight under different names and again with a used name works as it should."> 7 <style> 8 ::highlight(foo) { 9 color: blue; 10 } 11 ::highlight(bar) { 12 background-color: yellow; 13 } 14 </style> 15 <body><span>One </span><span>two </span><span>three…</span> 16 <script> 17 let r = new Range(); 18 r.setStart(document.body, 0); 19 r.setEnd(document.body, 2); 20 21 let h = new Highlight(r); 22 23 CSS.highlights.set("foo", h); 24 CSS.highlights.set("bar", h); 25 CSS.highlights.set("foo", h); 26 </script>