<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<script src="../../resources/js-test-pre.js"> </script>
<script>
window.jsTestIsAsync = true;

function test() {
    document.forms.f.submit();
}
</script>
<body onload="test()">
<p>Test that when dir attribute is specified for non html element, it is not considered for dirname attribute value in submission body.</p>
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 400 400" dir="rtl">
    <div>
    <form action="#action" method="GET" name="f">
        <input type=text name="nonHtmlAncestor" dirname="nonHtmlAncestor.dir"> 
        <p><button name="mode" type=submit value="add">Post Comment</button></p>
    </form>
    </div>
</svg>
<div id="console"></div>
<div id="action">
<script>
if (document.location.href.match('\\?')) {
    shouldBeTrue('document.location.search.indexOf("nonHtmlAncestor.dir=ltr") != -1');
    finishJSTest();
}

successfullyParsed = true;
</script>
</div>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
