dir-html-input-dynamic-text.html (1017B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1622900"> 6 <link rel="help" href="https://html.spec.whatwg.org/#the-directionality"> 7 <input value="ltr" dir="auto"> 8 <script> 9 test(function() { 10 let input = document.querySelector("input"); 11 assert_true(input.matches(":dir(ltr)"), "Input with ltr value should match dir(ltr)"); 12 input.textContent = "ﷺ"; 13 assert_true(input.matches(":dir(ltr)"), "Should still match dir(ltr) after text change"); 14 input.value = "ltr2"; 15 assert_true(input.matches(":dir(ltr)"), "Should still match dir(ltr) after value change"); 16 input.value = "ﷺ"; 17 assert_true(input.matches(":dir(rtl)"), "Should match dir(rtl) after value change"); 18 input.textContent = "ltr"; 19 assert_true(input.matches(":dir(rtl)"), "Should match dir(rtl) after text change"); 20 }, ":dir on <input> isn't altered by text children") 21 </script>