tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

seg-break-transformation-016.tentative.html (3769B)


      1 <!DOCTYPE html>
      2 <html  lang="en" >
      3 <head>
      4 <meta charset="utf-8">
      5 <title>Thai with ZWSP before line break</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="If the character immediately before or immediately after the segment break is the zero-width space character (U+200B), then the break is removed, leaving behind the zero-width space.">
      9 <style type='text/css'>
     10 /* the CSS below is not part of the test */
     11 .test span { font-size: 24px; font-family: sans-serif; background-color: #2AA5F7; color: white; }
     12 .ref span { font-size: 24px; font-family: sans-serif; background-color: #270CEF; color: white; }
     13 </style>
     14 <script src="/resources/testharness.js"></script>
     15 <script src="/resources/testharnessreport.js"></script>
     16 </head>
     17 <body>
     18 <div id='log'></div>
     19 <div id='test1' class="test"><span>ภาษา&#x200B;
     20 ไทย</span></div>
     21 <div id='test2' class="test"><span>ภาษา&#x200B;&#x20;&#x20;&#x20;
     22 ไทย</span></div>
     23 <div id='test3' class="test"><span>ภาษา&#x200B;
     24 &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;ไทย</span></div>
     25 <div id='test4' class="test"><span>ภาษา&#x200B;&#x20;&#x20;&#x20;
     26 &#x20;&#x20;&#x20;&#x20;&#x20;ไทย</span></div>
     27 <div id='test5' class="test"><span>ภาษา&#x200B;
     28 
     29 
     30 ไทย</span></div>
     31 <div id='test6' class="test"><span>ภาษา&#x200B;&#x20;&#x20;
     32 &#x20;&#x20;&#x20;
     33 &#x20;&#x20;&#x20;
     34 &#x20;&#x20;&#x20;ไทย</span></div>
     35 <div id="ref" class="ref"><span>ภาษาไทย</span></div>
     36 <script>
     37 test(function() {
     38 assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
     39 }, "linebreak only");
     40 var matches = document.getElementById('test1').firstChild.textContent.match(/\u200B/g)
     41 test(function() {
     42 assert_equals(matches.length, 1);
     43 }, "zwsp retained 1");
     44 test(function() {
     45 assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
     46 }, "spaces linebreak");
     47 var matches = document.getElementById('test2').firstChild.textContent.match(/\u200B/g)
     48 test(function() {
     49 assert_equals(matches.length, 1);
     50 }, "zwsp retained 2");
     51 test(function() {
     52 assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
     53 }, "linebreak spaces");
     54 var matches = document.getElementById('test3').firstChild.textContent.match(/\u200B/g)
     55 test(function() {
     56 assert_equals(matches.length, 1);
     57 }, "zwsp retained 3");
     58 test(function() {
     59 assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
     60 }, "spaces linebreak spaces");
     61 var matches = document.getElementById('test4').firstChild.textContent.match(/\u200B/g)
     62 test(function() {
     63 assert_equals(matches.length, 1);
     64 }, "zwsp retained 4");
     65 test(function() {
     66 assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
     67 }, "multiple linebreaks");
     68 var matches = document.getElementById('test5').firstChild.textContent.match(/\u200B/g)
     69 test(function() {
     70 assert_equals(matches.length, 1);
     71 }, "zwsp retained 5");
     72 test(function() {
     73 assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
     74 }, "multiple linebreaks + spaces");
     75 var matches = document.getElementById('test6').firstChild.textContent.match(/\u200B/g)
     76 test(function() {
     77 assert_equals(matches.length, 1);
     78 }, "zwsp retained 6");
     79 </script>
     80 <!-- Notes:
     81 The assertion will fail if a normal space is produced for any line in the test paragraph.
     82 -->
     83 </body>
     84 </html>