selectolax icon indicating copy to clipboard operation
selectolax copied to clipboard

HTMLParser and LexborHTMLParser search differently

Open SkySandy opened this issue 1 year ago • 1 comments

in``` 'td class="table-main__odds" data-odd="3.45" data-oid="6e0f1xv498x0x0" /td'


css_first('[data-odd]') doesn't find attribute for LexborHTMLParser
but HTMLParser finds this attribute


I removed the tags <> because they were not shown in the topic

SkySandy avatar Jan 01 '24 18:01 SkySandy

Hi @SkySandy

This is the correct behavior for HTML (LexborHTMLParser ). Unfortunately HTMLParser does not handle the above example correctly.

<td class="table-main__odds" data-odd="3.45" data-oid="6e0f1xv498x0x0"></td>

A TD tag without a TABLE tag will be deleted (not inserted into the final HTML tree). Actually, that's why it can't be found through the selector, it's just not there.

Try opening your example in a modern browser and you'll see exactly the same behavior.

lexborisov avatar Jan 06 '24 13:01 lexborisov