File: dirname-rtl-auto.html

package info (click to toggle)
thunderbird 1%3A91.12.0-1~deb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,008,300 kB
  • sloc: cpp: 6,084,052; javascript: 4,790,441; ansic: 3,341,486; python: 862,958; asm: 366,542; xml: 204,277; java: 152,477; sh: 111,376; makefile: 21,388; perl: 15,312; yacc: 4,583; objc: 3,026; lex: 1,720; exp: 762; pascal: 635; awk: 564; sql: 453; php: 436; lisp: 432; ruby: 99; sed: 69; csh: 45
file content (37 lines) | stat: -rw-r--r-- 1,647 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE html>
<meta charset=utf-8>
<title>Submitting element directionality: the dirname attribute</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org">
<link rel=help href="https://html.spec.whatwg.org/multipage/#submitting-element-directionality:-the-dirname-attribute">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<form action="dirname-ltr-iframe.html" method=get target="iframe">
  <p><label>Comment: <input type=text name="comment" dir="auto" dirname="comment.dir" required/></label></p>
  <p><button type=submit>Post Comment</button></p>
</form>
<iframe name="iframe"></iframe>
<script>
  function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
    results = regex.exec(document.querySelector("iframe").contentWindow.location.search);
    return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
  }

  var t = async_test("submit element directionality");
  var rtlValue = "مرحبا";
  document.querySelector("input").value = rtlValue;
  document.querySelector("button").click();

  var iframe = document.querySelector("iframe");
  iframe.onload = t.step_func(function() {
    // The initial about:blank load event can be fired before the form navigation occurs.
    // See https://github.com/whatwg/html/issues/490 for more information.
    if(iframe.contentWindow.location.href == "about:blank") { return; }

    assert_equals(getParameterByName("comment.dir"), "rtl");

    t.done();
  });
</script>