forked from ashi009/node-fast-html-parser
-
Notifications
You must be signed in to change notification settings - Fork 104
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
Quotes in HTML attributes escaped which breaks HTML #62
Comments
Sorry I am afraid this would lead to other errors. you can fork this lib and run |
lamplightdev
added a commit
to lamplightdev/node-html-parser
that referenced
this issue
May 20, 2021
Currently double quotes (") are not escaped in attribute values causing those attributes not to be set correctly. This commit replaces double quotes with `"`.
I've come across this issue too, and it can be solved by replacing double quotes (") with |
@lamplightdev Thank you. |
taoqf
added a commit
that referenced
this issue
May 22, 2021
Fixes #62 - Escape double quotes in attribute values
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi!
I wanted to report an issue:
JSON values of HTML attributes are rewritten to an escaped value which breaks the HTML:
Result of
.toString()
:Edit
Since the goal of the HTML parser is speed, it may be best to replace
JSON.stringify
for HTML attributes with a simple string based value verification and leave the original value, even if it would be a mere space or empty string, intact. It could save 50,000+JSON.stringify
calls for some HTML documents.For some attributes or Javascript functionality it does matter if the attribute contains
=""
. Stripping it would cost parsing resources while it seems to provide no other advantage than HTML compression, which does not seem to be a goal of the HTML parser.The following example may provide a hint for a solution:
The text was updated successfully, but these errors were encountered: