jsdom: selector doesn't return all elements

Basic info:

  • Node.js version: 8.0.0
  • jsdom version: 11.0.0

Minimal reproduction case

here is what chrome returns

const r = require('request')
const jsdom = require("jsdom");
const { JSDOM } = jsdom



r('http://www.clasificadosonline.com/Rentals.asp', function (err, response, body) {
  const dom = new JSDOM(body, {
    userAgent: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36",
  });

  console.log(
    dom.window.document
      .querySelectorAll('tr[bgcolor="#ffffff"] a[href^="/PartnersListingREFRID.asp?"]')
      .length 
  )
})

here is what jsdom returns

note that I’ve test requestjs response and it does include the complete HTML

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 24 (12 by maintainers)

Most upvoted comments

@Zirro thank you so much for the review !!!

I removed the XHTML_TABLE from the sources so for XML document the comparison will always be case sensitive also in “nwmatcher.js”. Notice that in previous versions of “nwmatcher-noqsa.js”, the one used in “jsdom”, the behavior was already like that, the XHTML_TABLE has never been used.

@domenic I will wait a couple of days before pushing 1.4.1 to npm.

Oh, I guess we or nwmatcher need to implement this: https://html.spec.whatwg.org/#case-sensitivity-of-selectors