Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"[foo]": function() {
var body = DomUtils.getElementsByTagName("body", document, true, 1)[0];
assertEquivalent(select("[href]", body), select("a[href]", body));
assertEquivalent(select("[class~=internal]"), select('a[class~="internal"]'));
assertEquivalent(select("[id]"), select("*[id]"));
assertEquivalent(select("[type=radio]"), getById("checked_radio", "unchecked_radio"));
assertEquivalent(select("[type=checkbox]"), select("*[type=checkbox]"));
assertEquivalent(select("[title]"), getById("with_title", "commaParent"));
assertEquivalent(select("#troubleForm [type=radio]"), select("#troubleForm *[type=radio]"));
assertEquivalent(select("#troubleForm [type]"), select("#troubleForm *[type]"));
},
"E[foo]": function() {
":last-child": function() {
var all = DomUtils.getElementsByTagName("div", pseudos);
expect(CSSselect("#pseudos div:last-child", document)[0]).to.be(all[all.length - 1]); //found last child
expect(CSSselect("#pseudos div:last-child", document)).to.have.length(1); //found only 1
},
":first-of-type": function() {
expect(CSSselect("#pseudos a:first-of-type", document)[0]).to.be(
DomUtils.getElementsByTagName("a", pseudos)[0]
); //found first a element
expect(CSSselect("#pseudos a:first-of-type", document)).to.have.length(1); //found only 1
},
":nth-child(odd|even|x)": function() {
var second = DomUtils.getElementsByTagName("div", pseudos)[1];
expect(CSSselect("#pseudos :nth-child(odd)", document)).to.have.length(4); //found 4 odd elements
expect(CSSselect("#pseudos div:nth-child(odd)", document)).to.have.length(3); //found 3 odd elements with div tag
expect(CSSselect("#pseudos div:nth-child(even)", document)).to.have.length(3); //found 3 even elements with div tag
expect(CSSselect("#pseudos div:nth-child(2)", document)[0]).to.be(second); //found 2nd nth-child of pseudos
},
E: function() {
//Type selector
var results = [],
index = 0,
nodes = DomUtils.getElementsByTagName("li", document);
while ((results[index] = nodes[index++])) {}
results.length--;
assertEquivalent(select("li"), results);
assertEqual(select("strong", getById("fixtures"))[0], getById("strong"));
assertEquivalent(select("nonexistent"), []);
},
"#id": function() {