custom-highlight-painting-below-grammar.html (1357B)
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-below-grammar-ref.html"> 6 <meta name="assert" value="Highlight overlay is painted below all other pseudo overlays (comparing only to grammar suffices since it's the one immediately above ::highlight, assuming ::grammar-error is painted in the correct order)"> 7 <style> 8 ::highlight(example-highlight) { 9 background-color: yellow; 10 color: blue; 11 } 12 ::grammar-error { 13 background-color: lime; 14 color: green; 15 } 16 </style> 17 <!-- 18 The grammar mistakes in the text below are intentional and part of this test. 19 20 https://html.spec.whatwg.org/multipage/interaction.html#spelling-and-grammar-checking 21 • contenteditable makes the text “checkable for the purposes of [spelling and grammar checking]” 22 • spellcheck tries to enable spelling and grammar checking (subject to user preferences) 23 • lang tries to guide the UA towards checking the text in English (but the UA may ignore this) 24 --> 25 <span contenteditable="true" spellcheck="true" lang="en">Many thing can happen.</div> 26 <script> 27 let r = new Range(); 28 r.setStart(document.body, 0); 29 r.setEnd(document.body, 1); 30 CSS.highlights.set("example-highlight", new Highlight(r)); 31 </script>