dir_auto-input-script-EN-L.html (2540B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8" /> 5 <title>HTML Test: input with dir=auto, script assigns to start with EN+L</title> 6 <link rel="match" href="dir_auto-input-script-EN-L-ref.html" /> 7 <link rel="author" title="Matitiahu Allouche" href="mailto:matitiahu.allouche@google.com" /> 8 <link rel="author" title="Oren Roth" href="mailto:oren.roth@gmail.com" /> 9 <link rel="author" title="Shai Berger" href="mailto:shai@platonix.com" /> 10 <link rel="author" title="HTML5 bidi test WG" href="mailto:html5bidi@googlegroups.com" /> 11 <link rel="help" href="https://html.spec.whatwg.org/multipage/#the-dir-attribute" /> 12 <meta name="assert" content=" 13 When dir='auto', the direction of an input element is set according to 14 the first strong character of its value. 15 In this test, it is the Latin letter A since digits are not strongly 16 directional, thus the direction must be resolved as LTR." /> 17 <style> 18 input, textarea { 19 font-size:1em; 20 } 21 body { 22 font-size:2em; 23 } 24 .test, .ref { 25 border: medium solid gray; 26 width: 400px; 27 margin: 20px; 28 } 29 .comments { 30 display: none; 31 } 32 </style> 33 </head> 34 <body> 35 <div class="instructions"><p>Test passes if the two boxes below look exactly the same.</p></div> 36 <div class="comments"> 37 Key to entities used below: 38 א - The Hebrew letter Alef (strongly RTL). 39 ב - The Hebrew letter Bet (strongly RTL). 40 ג - The Hebrew letter Gimel (strongly RTL). 41 This test makes sure that the direction is set correctly for an input whose value is set 42 dynamically by script. 43 </div> 44 <div id="test" class="test"> 45 <script> 46 window.onload = function() { 47 var test = document.getElementById('test'); 48 var inputs = test.getElementsByTagName('input'); 49 for (var i = 0; i != inputs.length; i++) { 50 inputs[i].value = '123ABC\u05D0\u05D1\u05D2.'; 51 } 52 } 53 </script> 54 <div dir="ltr"> 55 <input type="text" dir="auto" value="א" /> 56 </div> 57 <div dir="rtl"> 58 <input type="text" dir="auto" value="א" /> 59 </div> 60 </div> 61 <div class="ref"> 62 <div dir="ltr"> 63 <input type="text" dir="ltr" value="123ABCאבג." /> 64 </div> 65 <div dir="rtl"> 66 <input type="text" dir="ltr" value="123ABCאבג." /> 67 </div> 68 </div> 69 </body> 70 </html>