ruby-position.html (2144B)
1 <!DOCTYPE html> 2 <link rel="help" href="https://drafts.csswg.org/css-ruby/#rubypos"> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <body> 6 7 <p><ruby id="o1" style="ruby-position: over">base<rt>annotation</rt></ruby></p> 8 <p><ruby id="o2" style="ruby-position: over">base<rt style="ruby-position: under">annotation</rt></ruby></p> 9 <p><ruby id="o3" style="ruby-position: under">base<rtc style="ruby-position: over"><rt style="ruby-position: under">annotation</rt></rtc></ruby></p> 10 11 <p><ruby id="u1" style="ruby-position: under">base<rt>annotation</rt></ruby></p> 12 <p><ruby id="u2" style="ruby-position: under">base<rt style="ruby-position: over">annotation</rt></ruby></p> 13 <p><ruby id="u3" style="ruby-position: over">base<rtc style="ruby-position: under"><rt style="ruby-position: over">annotation</rt></rtc></ruby></p> 14 15 <script> 16 test(() => { 17 const o1 = document.querySelector('#o1'); 18 assert_true(o1.querySelector('rt').getBoundingClientRect().top <= o1.getBoundingClientRect().top); 19 }, 'ruby-position:over on <ruby> works'); 20 21 test(() => { 22 const o2 = document.querySelector('#o2'); 23 assert_true(o2.querySelector('rt').getBoundingClientRect().top <= o2.getBoundingClientRect().top); 24 }, 'ruby-position:under on <rt> should not work'); 25 26 test(() => { 27 const o3 = document.querySelector('#o3'); 28 assert_true(o3.querySelector('rt').getBoundingClientRect().top <= o3.getBoundingClientRect().top); 29 }, 'ruby-position:over on <rtc> works'); 30 31 test(() => { 32 const u1 = document.querySelector('#u1'); 33 assert_true(u1.querySelector('rt').getBoundingClientRect().bottom >= u1.getBoundingClientRect().bottom); 34 }, 'ruby-position:under on <ruby> works'); 35 36 test(() => { 37 const u2 = document.querySelector('#u2'); 38 assert_true(u2.querySelector('rt').getBoundingClientRect().bottom >= u2.getBoundingClientRect().bottom); 39 }, 'ruby-position:over on <rt> should not work'); 40 41 test(() => { 42 const u3 = document.querySelector('#u3'); 43 assert_true(u3.querySelector('rt').getBoundingClientRect().bottom >= u3.getBoundingClientRect().bottom); 44 }, 'ruby-position:under on <rtc> works'); 45 46 </script> 47 </body>