Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML: some basic direction tests #41620

Merged
merged 1 commit into from
Aug 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions html/dom/elements/global-attributes/dir-assorted.window.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
test(() => {
assert_true(document.documentElement.matches(":dir(ltr)"));
}, "Root element has a direction");

test(() => {
const ele = document.createElement("foobar");
assert_true(ele.matches(":dir(ltr)"));
}, "Element outside the document tree has a direction");

test(() => {
const ele = document.createElementNS("foobar", "foobar");
assert_true(ele.matches(":dir(ltr)"));
}, "Non-HTML element outside the document tree has a direction");

test(() => {
const ele = document.createElement("foobar");
ele.dir = "rtl";
const ele2 = document.createElement("foobar");
ele.append(ele2);
assert_true(ele2.matches(":dir(rtl)"));
}, "Element without direction has parent element direction");

test(() => {
const ele = document.createElement("foobar");
ele.dir = "rtl";
const ele2 = document.createElementNS("foobar", "foobar");
ele.append(ele2);
assert_true(ele2.matches(":dir(rtl)"));
}, "Non-HTML element without direction has parent element direction");