-
Notifications
You must be signed in to change notification settings - Fork 225
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
Fix #482: "Error when encoded quotes are used in html attribute" #526
base: master
Are you sure you want to change the base?
Conversation
@@ -37,6 +37,7 @@ | |||
"dependencies": { | |||
"cheerio": "^1.0.0", | |||
"commander": "^12.1.0", | |||
"entities": "^4.5.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already a transitive dependency through cheerio. I chose this version because our version of cheerio depends on 4.5.0.
Looks good to me. @jrit? |
I was looking at this a bit more, because I would have expected cheerio to decode on parse. But the Lines 9 to 13 in ff01a24
Now, you'd think that anything inside I don't know what to make of this, but this is longstanding juice behavior, so it's probably best to leave alone. |
Looks good to me. To answer the question of why it would be like that - it is probably because there were some old issues of people using juice in really unique ways to preprocess odd bits of code and the less juice modified those things by trying to be smart about encodings the better it seemed to support those scenarios. |
Fix #482
This PR adds an option to decode HTML entities in the style attribute before it is handed off to mensch for parsing. The problem is that although HTML entities are valid in
style
attribute values, they are not valid in CSS strings, resulting in a mensch parse that contains invalid properties/values, and ultimately causes juice to fail.