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

Is the input HTML document required to be formatted? #1345

Closed
EnochGao opened this issue Jun 12, 2024 · 5 comments · Fixed by #1347
Closed

Is the input HTML document required to be formatted? #1345

EnochGao opened this issue Jun 12, 2024 · 5 comments · Fixed by #1347
Assignees
Labels

Comments

@EnochGao
Copy link
Member

Describe the bug
I'm not sure if this is a bug, but when the same file is processed, one version is minified and the other is formatted; the minified file results in errors.

minified
formatted

@EnochGao
Copy link
Member Author

I found that formatting using prettiter is normal, but formatting inside vscode is not

2024-06-12.13-14-54.mp4

@EnochGao
Copy link
Member Author

I find it normal to remove all comment nodes. html = html.replace(/<!---->/g, ' ')

@MurakamiShinyu
Copy link
Member

The results must not vary depending on whether the HTML code is formatted or not, or whether there are comments or not. If it changes the result or causes errors, it is an obvious bug.

The error "InvalidNodeTypeError: Failed to execute 'setStartBefore' on 'Range': the given Node has no parent." occurs in

range.setStartBefore(node);
where the node must have parent node but does not.

@MurakamiShinyu MurakamiShinyu self-assigned this Jun 14, 2024
@MurakamiShinyu
Copy link
Member

I found that this error occurs with simple cases where a table cell contains some long text which spans multipe pages and an empty element.

This is a regression bug in v2.30.0 and the previous versions do not have this problem.

Examples:

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