Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The html rendering result is different from the html output result when we have two unclosed tbody tags #540

Closed
pauloortins opened this issue Feb 23, 2024 · 2 comments
Assignees

Comments

@pauloortins
Copy link

pauloortins commented Feb 23, 2024

When we have two unclosed tbody tags the output is different from the way chrome renders it.
While chrome closes the first tbody before the second opening tbody, HAP adds two closing tbody tags at the end.

HTML: <table><tbody><tr><td></td></tr><tbody><tr><td></td></tr></table>
HAP Result: <table><tbody><tr><td></td></tr><tbody><tr><td></td></tr></tbody></tbody></table>
Chrome Result: <table><tbody><tr><td></td></tr></tbody><tbody><tr><td></td></tr></tbody></table>

This is the test I used:

var html = @"<table><tbody><tr><td></td></tr><tbody><tr><td></td></tr></table>";
var doc = new HtmlDocument();
doc.LoadHtml(html);
var newHtml = doc.DocumentNode.OuterHtml;  //<table><tbody><tr><td></td></tr><tbody><tr><td></td></tr></tbody></tbody></table>
var res = @"<table><tbody><tr><td></td></tr></tbody><tbody><tr><td></td></tr></tbody></table>"; //chrome or edge rendering results
var b = newHtml == res; //false
@JonathanMagnan JonathanMagnan self-assigned this Feb 23, 2024
@JonathanMagnan
Copy link
Member

Hello @pauloortins ,

Thank you for reporting.

We will add a rule similar to what we did here for <tbody>: a7b18a3

Best Regards,

Jon

@JonathanMagnan
Copy link
Member

Hello @pauloortins ,

v1.11.60 is now available. The tbody will now be closed when the parent tag is also a tbody, like in your case.

Best Regards,

Jon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants