mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 17:55:07 +02:00
LibWeb: Update Element::directionality() to match current spec text
This fixes a crash that occurred when determining the directionality of input elements.
This commit is contained in:
committed by
Andrew Kaster
parent
23473d64ca
commit
57f0ea186e
Notes:
sideshowbarker
2024-07-17 01:53:23 +09:00
Author: https://github.com/tcl3 Commit: https://github.com/SerenityOS/serenity/commit/57f0ea186e Pull-request: https://github.com/SerenityOS/serenity/pull/24207 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/AtkinsSJ Reviewed-by: https://github.com/shannonbooth ✅
44
Tests/LibWeb/Text/input/css/dir-pseudo-on-input-element.html
Normal file
44
Tests/LibWeb/Text/input/css/dir-pseudo-on-input-element.html
Normal file
@@ -0,0 +1,44 @@
|
||||
<!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>
|
||||
Reference in New Issue
Block a user