white-space-collapse-001.html (4039B)
1 <!DOCTYPE html> 2 <html lang="en" > 3 <head> 4 <meta charset="utf-8"> 5 <title>White space and non-ASCII spaces</title> 6 <link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'> 7 <link rel='help' href='https://drafts.csswg.org/css-text-3/#line-break-transform'> 8 <meta name="assert" content="Any space immediately following another collapsible space is collapsed to have zero advance width. Only refers to U+0020, not other Unicode spaces."> 9 <style type='text/css'> 10 .test span { font-size: 24px; font-family: sans-serif; background-color: #2AA5F7; color: white; } 11 .ref span { font-size: 24px; font-family: sans-serif; background-color: #270CEF; color: white; } 12 </style> 13 <script src="/resources/testharness.js"></script> 14 <script src="/resources/testharnessreport.js"></script> 15 </head> 16 <body> 17 <div id='log'></div> 18 <div id='testNB' class="test"><span>hello           there</span></div> 19 <div id="refNB" class="ref"><span>hello   there</span></div> 20 <div id='testEN' class="test"><span>hello           there</span></div> 21 <div id="refEN" class="ref"><span>hello   there</span></div> 22 <div id='testEM' class="test"><span>hello           there</span></div> 23 <div id="refEM" class="ref"><span>hello   there</span></div> 24 <div id='testTS' class="test"><span>hello           there</span></div> 25 <div id="refTS" class="ref"><span>hello   there</span></div> 26 <div id='testZW' class="test"><span>hello   ​       there</span></div> 27 <div id="refZW" class="ref"><span>hello ​ there</span></div> 28 <div id='testNNB' class="test"><span>hello           there</span></div> 29 <div id="refNNB" class="ref"><span>hello   there</span></div> 30 <div id='testIS' class="test"><span>hello           there</span></div> 31 <div id="refIS" class="ref"><span>hello   there</span></div> 32 <div id='testIS2' class="test"><span>缔造真正全球通行           的万维网</span></div> 33 <div id="refIS2" class="ref"><span>缔造真正全球通行   的万维网</span></div> 34 <script> 35 test(function() { 36 assert_equals(document.getElementById('testNB').firstChild.offsetWidth, document.getElementById('refNB').firstChild.offsetWidth); 37 }, "no-break space"); 38 test(function() { 39 assert_equals(document.getElementById('testEN').firstChild.offsetWidth, document.getElementById('refEN').firstChild.offsetWidth); 40 }, "en space"); 41 test(function() { 42 assert_equals(document.getElementById('testEM').firstChild.offsetWidth, document.getElementById('refEM').firstChild.offsetWidth); 43 }, "em space"); 44 test(function() { 45 assert_equals(document.getElementById('testTS').firstChild.offsetWidth, document.getElementById('refTS').firstChild.offsetWidth); 46 }, "thin space"); 47 test(function() { 48 assert_equals(document.getElementById('testZW').firstChild.offsetWidth, document.getElementById('refZW').firstChild.offsetWidth); 49 }, "zero width space"); 50 test(function() { 51 assert_equals(document.getElementById('testZW').firstChild.offsetWidth, document.getElementById('refZW').firstChild.offsetWidth); 52 }, "narrow no-break space"); 53 test(function() { 54 assert_equals(document.getElementById('testIS').firstChild.offsetWidth, document.getElementById('refIS').firstChild.offsetWidth); 55 }, "ideographic space"); 56 test(function() { 57 assert_equals(document.getElementById('testIS2').firstChild.offsetWidth, document.getElementById('refIS2').firstChild.offsetWidth); 58 }, "ideographic space inside ideographic text"); 59 </script> 60 <!-- Notes: 61 The assertion will fail if space is produced for any line in the test paragraph. 62 --> 63 </body> 64 </html>