<!DOCTYPE html>
<meta charset=utf-8>
<title>Submitting element directionality: the dirname attribute</title>
<link rel="author" title="Kolupaev Dmitry" href="mailto:dmitry.klpv@gmail.com">
<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>
<script src="resources/dirname.js"></script>
<div id="log"></div>
<div dir="rtl">
  <form action="resources/dirname-iframe.html" method=get target="iframe">
    <p><label>User: <input type=text name="user" dirname="user.dir" required/></label></p>
    <p><label>Comment: <textarea name="comment" dirname="comment.dir" required></textarea></label></p>
    <p><button type=submit>Post Comment</button></p>
  </form>
</div>
<iframe name="iframe"></iframe>
<script>
  document.querySelector("input").value = "foobar";
  document.querySelector("textarea").value = "foobar";
  document.querySelector("button").click();

  var t_inp = async_test("submit input element directionality");
  onIframeLoadedDone(t_inp, function(params) {
    assert_equals(params.get("user.dir"), "rtl");
  });

  var t_ta = async_test("submit textarea element directionality");
  onIframeLoadedDone(t_ta, function(params) {
    assert_equals(params.get("comment.dir"), "rtl");
  });
</script>
