selection-overlay-and-grammar-001.html (2169B)
1 <!DOCTYPE html> 2 3 <html> 4 5 <meta charset="UTF-8"> 6 7 <title>CSS Pseudo-Elements Test: ::selection overlay drawn over the ::grammar-error overlay</title> 8 9 <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/"> 10 <link rel="help" href="https://www.w3.org/TR/css-pseudo-4/#highlight-painting"> 11 <link rel="match" href="reference/selection-overlay-and-grammar-001-ref.html"> 12 13 <meta name="assert" content="In this test, the div::selection pseudo-element must be drawn over the div::grammar-error overlay."> 14 15 <link rel="stylesheet" href="support/highlights.css"> 16 <style> 17 div 18 { 19 font-size: 60px; 20 line-height: 90px; 21 } 22 23 div::selection 24 { 25 background-color: rgba(0%, 50%, 100%, 0.5); 26 /* 27 a very lite blue color 28 according to 29 https://www.colorhexa.com/7fbfff 30 */ 31 color: yellow; 32 } 33 34 div::grammar-error 35 { 36 background-color: yellow; 37 color: red; 38 } 39 </style> 40 41 <script src="support/selections.js"></script> 42 43 <p>PREREQUISITE: User agent needs to have an enabled and capable grammar error module. If it does not, then this test does not apply to such user agent. 44 45 <p>Test passes 46 47 <ul> 48 <li>if each glyph of the sentence is yellow 49 <li>if "thing" has a desaturated lime green background 50 <li>if the other words have a very lite blue background and 51 <li>if there is no red. 52 </ul> 53 54 <!-- 55 The grammar mistakes in the text below are intentional and part of this test. 56 57 https://html.spec.whatwg.org/multipage/interaction.html#spelling-and-grammar-checking 58 • contenteditable makes the text “checkable for the purposes of [spelling and grammar checking]” 59 • spellcheck tries to enable spelling and grammar checking (subject to user preferences) 60 • lang tries to guide the UA towards checking the text in English (but the UA may ignore this) 61 --> 62 <div id="test" class="highlight_reftest" contenteditable="true" spellcheck="true" lang="en">Many thing can happen.</div> 63 64 <script> 65 const test = document.querySelector("#test"); 66 selectNodeContents(test); 67 trySpellcheck(test); 68 </script>