node-html-parser icon indicating copy to clipboard operation
node-html-parser copied to clipboard

`querySelector()` missing element

Open martinreus opened this issue 9 months ago • 0 comments

Hello,

first of all, thanks for this library, it is awesome! I was using it to parse some rental ads websites and I think I might have found a slight issue with the querySelector - and also querySelectorAll

when I try to

  const adFile = readFileSync("./adFile.html", "utf-8");

  const parsed = parse(adFile);
  const propDiv = parsed.querySelector(`div[itemProp="description"]`);

on this file, propDiv will be returned null, when in fact it probably should find div with content

<div itemProp="description">Unit 1 - 61 Mackay Avenue

<p><u>Key Features:</u></p><ul><li>3 Bedroom / 1 Bathroom Main Floor Unit</li><li></div>

in the html file. It works fine for other files such as this one

martinreus avatar Feb 18 '25 16:02 martinreus