Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/forms/attributes-common-to-form-controls/dirname-ltr.html - WPT Dashboard Interop Dashboard
<!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>
<script src="resources/dirname.js"></script>
<div id="log"></div>
<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>
<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"), "ltr");
});
var t_ta = async_test("submit textarea element directionality");
onIframeLoadedDone(t_ta, function(params) {
assert_equals(params.get("comment.dir"), "ltr");
});
</script>