x-ray bug

node v8.17.0
version: 2.0.0
endpointsharetweet
"given the following piece of html:" const html = ` <body> <ul> <li>1-1</li> <li>1-2</li> <li>1-3</li> </ul> <ul> <li>2-1</li> <li>2-2</li> <li>2-3</li> </ul> <ul> <li>3-1</li> <li>3-2</li> <li>3-3</li> </ul> </body>` "and this version of xray" const xray = require("x-ray") ;`What docs say about collections: X-ray also has support for selecting collections of tags. While x('ul', 'li') will only select the first list item in an unordered list, x('ul', ['li']) will select all of them. Additionally, X-ray supports "collections of collections" allowing you to smartly select all list items in all lists with a command like this: x(['ul'], ['li']).` "***"
"per docs X-ray x('ul', ['li']) should select all items in the first list but it selects all items in all lists." const x = xray() x(html, x("ul", ["li"]))((err, result) => { console.log("result below:") console.log(result) }) "***"
"per docs this should return x(['ul'], ['li']) all items in all lists, but it returns nothing." const x2 = xray() x2(html, x2(["ul"], ["li"]))((err, result) => { console.log("result below:") console.log(result) }) "***"
Loading…

no comments

    sign in to comment