white-space-collapse-000.html (2560B)
1 <!DOCTYPE html> 2 <html lang="en" > 3 <head> 4 <meta charset="utf-8"> 5 <title>White space collapse</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="Every tab is converted to a space. Any space immediately following another collapsible space is collapsed to have zero advance width."> 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='test' class="test"><span>hello   	       there</span></div> 19 <div id="ref" class="ref"><span>hello there</span></div> 20 <div id='testW' class="test"><span>缔造真正全球通行       	   的万维网</span></div> 21 <div id="refW" class="ref"><span>缔造真正全球通行 的万维网</span></div> 22 <div id='testF' class="test"><span>FULL   	        WIDTH</span></div> 23 <div id="refF" class="ref"><span>FULL  WIDTH</span></div> 24 <div id='testH' class="test"><span>ハン   	         カク</span></div> 25 <div id="refH" class="ref"><span>ハン   カク</span></div> 26 <script> 27 test(function() { 28 assert_equals(document.getElementById('test').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth); 29 }, "spaces removed"); 30 test(function() { 31 assert_equals(document.getElementById('testW').firstChild.offsetWidth, document.getElementById('refW').firstChild.offsetWidth); 32 }, "spaces removed between Wide characters"); 33 test(function() { 34 assert_equals(document.getElementById('testF').firstChild.offsetWidth, document.getElementById('refF').firstChild.offsetWidth); 35 }, "spaces removed between Fullwidth characters"); 36 test(function() { 37 assert_equals(document.getElementById('testH').firstChild.offsetWidth, document.getElementById('refH').firstChild.offsetWidth); 38 }, "spaces removed between Halfwidth characters"); 39 </script> 40 <!-- Notes: 41 The assertion will fail if space is produced for any line in the test paragraph. 42 --> 43 </body> 44 </html>