text-overflow-012.html (1797B)
1 <!DOCTYPE html> 2 <html> 3 <meta charset="utf-8"> 4 <title>CSS Basic User Interface Test: ellipsis and extended grapheme cluster</title> 5 <link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/"> 6 <link rel="help" href="http://www.w3.org/TR/css3-ui/#text-overflow"> 7 <link rel="match" href="reference/text-overflow-012-ref.html"> 8 <meta name="flags" content="should"> 9 <!-- This is SHOULD because although CSS-UI defines "character" as "grapheme cluster" in a non optional manner 10 UAX29 itself defines grapheme cluster as either legacy or extended grapheme clusters, 11 and says (emphasis mine): 12 The extended grapheme clusters **should** be used 13 in implementations in preference to legacy grapheme clusters 14 --> 15 <meta name="assert" content="Implementations must hide characters, i.e. entire garpheme clusters, not part of them, to make room for the ellipsis"> 16 <style> 17 #sizer { 18 font-size: 50px; 19 white-space: pre; 20 color: white; 21 float: left; 22 position: relative; 23 } 24 25 #test { 26 overflow: hidden; 27 text-overflow: ellipsis; 28 position: absolute; 29 top: 0; right: 2px; bottom: 0; left: 0; 30 color: green; 31 } 32 span { 33 color: red; 34 } 35 36 </style> 37 38 <p>Test passes if there are three green dots below and <strong>no red</strong>.</p> 39 40 <!--Starting the line with an space because the first character on the line is clipped rather than ellided, so we need the tested grapheme cluster to be non-first--> 41 <!-- 42 sizer shrinkwraps to the size of a space, plus the grapheme cluster, plus the ellipsis. 43 test is 2px shorter than that, so it can only fit part of the grapheme cluster. 44 The whole grapheme cluster should be removed, not just its second character. 45 --> 46 47 <div id=sizer> กำ…<div id=test> <span>กำfiller text to make things overflow</span></div><div>