taoqf / node-html-parser

A very fast HTML parser, generating a simplified DOM, with basic element query support.
MIT License
1.12k stars 112 forks source link

CSS Selector :nth-child() return null (not implemented ?) #74

Closed mathias22osterhagen22 closed 3 years ago

mathias22osterhagen22 commented 4 years ago
<tbody>
   <tr class="odd">
      <td>13/10/2020</td>
      <td>
         Cell2
      </td>
      <td>
         <a href="/mjrcs-32432">Cell3</a>
      </td>
      <td>
         <a target="_blank" href="/5z9LX1.pdf" ><img alt="PDF File" src="/mjrcs-resa/images/v2/icone_pdf.gif"></a>
      </td>
      <td>
         <a target="winzip" href="/33WzKc.zip"><img alt="ZIP File" src="/mjrcs-resa/images/v2/icone_pdf_archive.gif" height="16" ></a>
      </td>
      <td>
         <a target="_blank" href="/3QhZGq.xml"><img alt="XML file"  src="/mjrcs-resa/images/v2/icone_xml.gif" height="16" ></a>
      </td>
      <td>
      </td>
   </tr>

Expected: document.querySelector('table tbody tr td:nth-child(6) a').href

/3QhZGq.xml

Result: document.querySelector('table tbody tr td:nth-child(6) a').href

null

Screenshoot: image

taoqf commented 4 years ago

I'm very sorry the selector is not supported yet.

mathias22osterhagen22 commented 3 years ago

Thank you for your answear, Is :not not implemented as well ? (and [href*="partOfUrl"] seems not working too)

taoqf commented 3 years ago

Thank you for your answear, Is :not not implemented as well ? (and [href*="partOfUrl"] seems not working too)

no.