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

(2) The html rendering result is different from the html output result #532

Closed
colindcli opened this issue Jan 19, 2024 · 4 comments
Closed
Assignees

Comments

@colindcli
Copy link

colindcli commented Jan 19, 2024

Similar to the previous situation in #529

spandiv

var html = @"<span><div></div></span>";
var doc = new HtmlDocument();
doc.LoadHtml(html);
var newHtml = doc.DocumentNode.OuterHtml;  //<span></span><div></div>
var res = @"<span><div></div></span>"; //chrome or edge rendering results
var b = newHtml == res;  //false

Test URL: https://dotnetfiddle.net/HrDL5G

@colindcli
Copy link
Author

colindcli commented Jan 19, 2024

second example:

There is also a more special code. The code has been simplified to the minimum. The outermost div is abnormal.

other

            var html = @"
<div>
    <span>
        <font>
            <div>
                <span>
                    <div></div>
                </span>
            </div>
        </font>
    </span>
    <span></span>
</div>";
            var doc = new HtmlDocument();
            doc.LoadHtml(html);
            var newHtml = doc.DocumentNode.OuterHtml;

newHtml value is:

<div>
    <span>
        <font>
            <div>
                <span></span>
                <div></div>
            </div>
        </font>
    </span>
</div>
<span></span>

div position is wrong!

Test URL: https://dotnetfiddle.net/K1JXDE

@Jagailo
Copy link

Jagailo commented Jan 23, 2024

I also want to join this issue, until version 57 this didn't cause an exception:

HtmlNode.CreateNode("<span><div></div></span>");

This code doesn't contain <p>, Chromium also allows such HTML
image

@JonathanMagnan JonathanMagnan self-assigned this Jan 23, 2024
@JonathanMagnan
Copy link
Member

Hello,

Thank you for reporting. We are already aware of this issue here: #531

It should be fixed really soon.

Best Regards,

Jon

@JonathanMagnan
Copy link
Member

Hello @colindcli , @Jagailo

The code added in v1.11.57 has been reverted in v1.11.58, so this issue should no longer happen.

More information can be found in the issue #529 for you @colindcli

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

3 participants