Would you like to clone this notebook?

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

Cancel

jsdom :nth-child with spaces test

node v8.17.0
version: 2.0.0
endpointsharetweet
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"); }
Loading…

no comments

    sign in to comment