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

Double <p> <p> open tags leave one <p> open even with option setted #538

Closed
Glorfindel88 opened this issue Feb 9, 2024 · 6 comments
Closed
Assignees

Comments

@Glorfindel88
Copy link

When trying to parse an html obtained from an editor, a double <p><p> open tag does not get closed.
Only one of the two is closed,
<p><p>
becomes
<p><p></p>
even when options OptionCheckSyntax, OptionFixNestedTags and OptionWriteEmptyNodes are set to true.

The only way both tags are closed is to set OptionOutputAsXml to true.

Here is a fiddle of what happens:

https://dotnetfiddle.net/pi92VJ

HAP version 1.11.58
.NET Framework 4.8

@JonathanMagnan JonathanMagnan self-assigned this Feb 10, 2024
@JonathanMagnan
Copy link
Member

Hello @Glorfindel88 ,

That is an expected behavior.

A p tag can be closed implicitly when followed by another p tag: https://www.w3.org/MarkUp/HTMLPlus/htmlplus_11.html#:~:text=The%20P%20element%20acts%20as%20a%20container%20for%20the%20text,tag%20as%20a%20paragraph%20separator.

See this line in the example on the page:

<P>The first piece of text<P>The second piece

Let me know if that answer correctly to your question.

Best Regards,

Jon

@Glorfindel88
Copy link
Author

Hello @JonathanMagnan ,
thank you for your answer.
I know the tags can work that way and that works as far as the browser is concerned.
But i did not think the behavior was expected, given the options. And a previous version of HAP we used, can't remember which one, did close the double tag. And we need to close all tags for other operations we then do on the html.
Is there any option setting that allows to close everything, or only OptionOutputAsXml?

Thanx,

Best Regards.

@JonathanMagnan
Copy link
Member

Hello @Glorfindel88 ,

There is currently no option, but we will look to see if we can add one. Everything looks to be already coded for this, so it should be very easy.

Best Regards,

Jon

@Glorfindel88
Copy link
Author

Thank you very much.

Best Regards

@JonathanMagnan
Copy link
Member

Hello @Glorfindel88 ,

The v1.11.59 has been released.

In this version, we added the option DisableImplicitEnd that you can now set to true to have the expected behavior.

Let me know if everything is now working as expected on your side.

Best Regards,

Jon

@Glorfindel88
Copy link
Author

Hello @JonathanMagnan
This works wonderfully, thank you very much.

Best Regards.

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