ladybird/Tests/LibWeb/Text/input/css/dir-pseudo-on-input-element.html
Tim Ledbetter 57f0ea186e LibWeb: Update Element::directionality() to match current spec text
This fixes a crash that occurred when determining the directionality of
input elements.
2024-05-07 16:45:28 -06:00

44 lines
1.3 KiB
HTML

<!DOCTYPE html>
<style>
.test {
font-size: 12px;
}
</style>
<script src="../include.js"></script>
<script>
test(() => {
function testSelectorMatch(input, selector) {
println(`Input matches ${selector}: ${input.matches(selector)}`);
}
const input = document.createElement("input");
input.type = "text";
input.value = "Well hello friends!"
testSelectorMatch(input, ":dir(ltr)");
testSelectorMatch(input, ":dir(rtl)");
input.dir = "invalid";
testSelectorMatch(input, ":dir(ltr)");
testSelectorMatch(input, ":dir(rtl)");
input.dir = "rtl";
testSelectorMatch(input, ":dir(ltr)");
testSelectorMatch(input, ":dir(rtl)");
input.dir = "auto"
testSelectorMatch(input, ":dir(ltr)");
testSelectorMatch(input, ":dir(rtl)");
input.value = "حسنًا ، مرحباً أيها الأصدقاء";
testSelectorMatch(input, ":dir(ltr)");
testSelectorMatch(input, ":dir(rtl)");
input.dir = "ltr"
testSelectorMatch(input, ":dir(ltr)");
testSelectorMatch(input, ":dir(rtl)");
input.removeAttribute("dir");
testSelectorMatch(input, ":dir(ltr)");
testSelectorMatch(input, ":dir(rtl)");
});
</script>