summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/dom/elements/global-attributes/lang-attribute.window.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/dom/elements/global-attributes/lang-attribute.window.js')
-rw-r--r--testing/web-platform/tests/html/dom/elements/global-attributes/lang-attribute.window.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/dom/elements/global-attributes/lang-attribute.window.js b/testing/web-platform/tests/html/dom/elements/global-attributes/lang-attribute.window.js
new file mode 100644
index 0000000000..de0c03e6f8
--- /dev/null
+++ b/testing/web-platform/tests/html/dom/elements/global-attributes/lang-attribute.window.js
@@ -0,0 +1,16 @@
+test(() => {
+ const container = document.createElement("div");
+ document.body.append(container);
+ container.setAttribute("lang", "en-CA");
+
+ const child = document.createElementNS("div", "test");
+ container.append(child);
+ child.setAttribute("lang", "en-NZ");
+
+ assert_true(container.matches(":lang(en-CA)"), "container matches en-CA");
+ assert_true(child.matches(":lang(en-CA)"), "child matches en-CA");
+ assert_false(container.matches(":lang(en-NZ)"), "container does not match en-NZ");
+ assert_false(child.matches(":lang(en-NZ)"), "child does not match en-NZ");
+
+ container.remove();
+}, "unnamespaced lang attribute only works on elements in the HTML namespace");