jsdom :nth-child with spaces test
const { JSDOM } = require('jsdom');
console.log("test without spaces");
testSelector('p:nth-last-child(2n+1)');
console.log("test without spaces");
testSelector('p:nth-last-child(2n + 1)');
function testSelector(selector) {
const dom = new JSDOM(`<!DOCTYPE html>
<div>
<p>second match</p>
<p>shouldn't match</p>
<p>first match</p>
</div>`,
);
const matches = dom.window.document.querySelectorAll(selector);
console.log(matches.length + " matches");
}
no comments