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