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

Improper DOM Generation Prevents Correct HTML Rendering #1578

Open
Lucacici opened this issue Sep 27, 2024 · 2 comments
Open

Improper DOM Generation Prevents Correct HTML Rendering #1578

Lucacici opened this issue Sep 27, 2024 · 2 comments

Comments

@Lucacici
Copy link

Some websites generate DOM structures in a non-standard manner, leading to HTML files that cannot be rendered correctly and require manual fixes.

Example

Problem
The browser cannot render a p element containing a nested ul. Change p to div to render it correctly.

Environment

  • OS: Win10
  • Browser: Firefox, Edge

Request
check if a p element contains any block elements, and replaces it with a div if necessary.

@gildas-lormeau
Copy link
Owner

gildas-lormeau commented Sep 27, 2024

The problem is that <div> is the tag of a block-level element and is also disallowed in a <p> tag. Only these tags are valid: https://developer.mozilla.org/en-US/docs/Web/HTML/Content_categories#phrasing_content.

@Lucacici
Copy link
Author

The problem is that <div> is the tag of a block-level element and is also disallowed in a <p> tag. Only these tags are valid: https://developer.mozilla.org/en-US/docs/Web/HTML/Content_categories#phrasing_content.

Yes, I understand what you're saying.

What I mean is that the dynamic pages provided by the server generate invalid DOM, which can be correctly rendered by the browser, but the browser can't properly render static invalid DOM (such as saved webpages).

I'm not sure if I should clean up the mess for the website.

@Lucacici Lucacici reopened this Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants