dir_auto-textarea-script-N-between-Rs.html (2920B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8" /> 5 <title>HTML Test: textarea with dir=auto, script assigns to all-N between all-Rs</title> 6 <link rel="match" href="dir_auto-textarea-script-N-between-Rs-ref.html" /> 7 <link rel="author" title="Aharon Lanin" href="mailto:aharon@google.com" /> 8 <link rel="author" title="HTML5 bidi test WG" href="mailto:html5bidi@googlegroups.com" /> 9 <link rel="help" href="https://html.spec.whatwg.org/multipage/#the-dir-attribute" /> 10 <link rel="help" href="http://dev.w3.org/csswg/css3-writing-modes/#unicode-bidi0" /> 11 <meta name="assert" content=" 12 When dir='auto', the direction is set according to the first strong character 13 of the text. 14 For textarea and pre elements, the heuristic is applied on a per-paragraph level. 15 If there is no strong character, as in this test, the direction defaults to LTR." /> 16 <style> 17 body, textarea { 18 font-size:18px; 19 text-align:left; 20 } 21 textarea { 22 resize: none; 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 This test makes sure that the direction is set correctly for a textarea whose value is set 40 dynamically by script. 41 We use text-align:left because neither the dir="auto" nor the unicode-bidi:plaintext 42 specification states whether text-align:start and text-align:end should obey the paragraph 43 direction or the direction property in a unicode-bidi:plaintext element. 44 The ...! paragraph, being neutral, is supposed to be displayed LTR (i.e. as ...!, not as !...) 45 despite both the paragraph before it and the paragraph after it being all-RTL, which makes the 46 element as a whole RTL. 47 </div> 48 <div id="test" class="test"> 49 <script> 50 window.onload = function() { 51 var test = document.getElementById('test'); 52 var textareas = test.getElementsByTagName('textarea'); 53 for (var i = 0; i != textareas.length; i++) { 54 textareas[i].value = '\u05D0\n...!\n\u05D0'; 55 } 56 } 57 </script> 58 <div dir="ltr"> 59 <textarea rows="4" dir="auto"> 60 LTR text 61 </textarea> 62 </div> 63 <div dir="rtl"> 64 <textarea rows="4" dir="auto"> 65 LTR text 66 </textarea> 67 </div> 68 </div> 69 <div class="ref"> 70 <div dir="ltr"> 71 <textarea rows="4" dir="rtl"> 72 א 73 !... 74 א</textarea> 75 </div> 76 <div dir="rtl"> 77 <textarea rows="4" dir="rtl"> 78 א 79 !... 80 א</textarea> 81 </div> 82 </div> 83 </body> 84 </html>