selecting collections doesn't work in a way specified in docs #131

Closed
opened 2025-10-14 18:14:01 -06:00 by navan · 0 comments
Owner

Originally created by @marzelin on 9/21/2017

Subject of the issue

Retrieving collections doesn't work as described in docs

Your environment

  • version of node: 8.5
  • version of npm: yarn 1.0.2

reproduction here: https://runkit.com/marzelin/x-ray-bug

given this example:

const x = require("x-ray")()
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>`

x(html, "body", x("ul", ["li"]))((err, result) => {
    console.log(result)
})

per docs x('ul', ['li']) should select all items in the first list but it selects all items in all lists.
Also, per docs x(['ul'], ['li']) should return all items in all lists, but it returns nothing.

*Originally created by @marzelin on 9/21/2017* ### Subject of the issue Retrieving collections doesn't work as described in docs ### Your environment * version of node: 8.5 * version of npm: yarn 1.0.2 reproduction here: https://runkit.com/marzelin/x-ray-bug given this example: ```js const x = require("x-ray")() 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>` x(html, "body", x("ul", ["li"]))((err, result) => { console.log(result) }) ``` per docs `x('ul', ['li'])` should select all items in the first list but it selects all items in all lists. Also, per docs `x(['ul'], ['li'])` should return all items in all lists, but it returns nothing.
navan 2025-10-14 18:14:03 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github/x-ray#131
No description provided.