Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.


jsdom :nth-child with spaces test

node v8.17.0
version: 2.0.0
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

    sign in to comment