summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/dom/elements/global-attributes/lang-attribute.window.js
blob: de0c03e6f853ecf2b5eac9e41274df49ee96c9e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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");