mathvariant-auto-selection.html (1319B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"/> 5 <title>text-transform math-auto</title> 6 <link rel="help" href="https://w3c.github.io/mathml-core/#math-auto-transform"> 7 <link rel="help" href="https://w3c.github.io/mathml-core/#italic-mappings"> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src="/css/css-text/text-transform/math/italic-mapping.js"></script> 11 <meta name="assert" content="Verify Selection.toString() on a single character <mi> within returns the transformed unicode character."> 12 </head> 13 <body> 14 <math><mi id="container"></mi></math> 15 <script> 16 add_completion_callback(() => { 17 container.remove(); 18 }); 19 for (let code_point in italic_mapping) { 20 test(() => { 21 container.textContent = String.fromCodePoint(code_point); 22 window 23 .getSelection() 24 .setBaseAndExtent(container.firstChild, 0, container.firstChild, 1); 25 assert_equals( 26 window.getSelection().toString(), 27 String.fromCodePoint(italic_mapping[code_point]) 28 ); 29 }, `Selection.toString() for <mi>${String.fromCodePoint(code_point)}</mi> returns the transformed character.`); 30 } 31 </script> 32 </body> 33 </html>