Open sergei-maertens opened 10 years ago
HTML structure:
Even in simpler cases it's returning multiple elements:
<!doctype html> <table> <tr> <td class="title" rowspan="2">...</td> <td>...</td> <td rowspan="2">...</td> <td class="subtable"> <table> <tbody> <tr> <td>...</td> </tr> <tr> <td>2 maanden:</td> <td>€110,-</td> </tr> <tr> <td colspan="2"></td> </tr> <tr> <td><strong>Jaarabonnement:</strong></td> <td>€1.230,-</td> </tr> <tr> <td></td> <td></td> </tr> <tr> <td colspan="2">Corporate: ...</td> </tr> </tbody> </table> </td> </tr> </table>
On the top row level I need to find the column contents, so I'm doing:
element.find(':first')
which returns td.title, td, td and td.subtable, where I'd expect just td.title. Element is a pq element of the parent row.
When trying to select the td after td.title
element.find('td:nth-child(2)')
it's completely skipping the direct children and instead looking in the td.subclass
HTML structure:
Even in simpler cases it's returning multiple elements:
On the top row level I need to find the column contents, so I'm doing:
which returns td.title, td, td and td.subtable, where I'd expect just td.title. Element is a pq element of the parent row.
When trying to select the td after td.title
it's completely skipping the direct children and instead looking in the td.subclass