lang-attribute.window.js (678B)
1 test(() => { 2 const container = document.createElement("div"); 3 document.body.append(container); 4 container.setAttribute("lang", "en-CA"); 5 6 const child = document.createElementNS("div", "test"); 7 container.append(child); 8 child.setAttribute("lang", "en-NZ"); 9 10 assert_true(container.matches(":lang(en-CA)"), "container matches en-CA"); 11 assert_true(child.matches(":lang(en-CA)"), "child matches en-CA"); 12 assert_false(container.matches(":lang(en-NZ)"), "container does not match en-NZ"); 13 assert_false(child.matches(":lang(en-NZ)"), "child does not match en-NZ"); 14 15 container.remove(); 16 }, "unnamespaced lang attribute only works on elements in the HTML namespace");