-
-
Notifications
You must be signed in to change notification settings - Fork 384
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
HtmlAttribute.Value should use HtmlEntity.DeEntitize when setting _value #19
Comments
Hello @drbsoftware , Thank you, my developer will look at this issue during the week. Best Regards, Jonathan |
Hello @drbsoftware , The v1.5.0-beta92 now use your fix. Let me know if that's correctly working. Best Regards, Jonathan |
HtmlEntity.DeEntitize method should not be called when setting HtmlAttribute.Value as it must be properly encoded, see this. As for getting the value, the property should, IMHO, return its original encoded value, and it's up to the caller whether to decode it or not. |
Hello @yfayerman , Thank you for reporting. I will have my developer look at it and check if we must do it differently. Best Regards, Jonathan |
8.1.2.3 Attributes in https://www.w3.org/TR/html5/syntax.html would seem to suggest that the parsing is the same for attributes and for HTML text. In our case, we are using custom data-* attributes. The data is stored by JavaScript using the Chromium DOM. We retrieve the attribute contents using HTML Agility Pack. We expect the data retrieved to be the same as the data stored. Thanks |
Hello @yfayerman , The setter does not longer use DeEntitize. The getter however still use it in order to solve @drbsoftware first issue. To mimic what a browser does. By example Please @yfayerman , @drbsoftware , let me know if we can close this issue or there is much work to do on it. Best Regards, Jonathan |
Jonathan, I think that looks right. |
@JonathanMagnan, that's fine with me. |
Closing Comment: Fix confirmed |
Hello @drbsoftware , @yfayerman , Finally, we had to rollback this fix in v1.5.1. @yfayerman is right, it should be up to the caller instead to DeEntitize or not the value. We cannot automatically DeEntitize it otherwise we will break some existing code like in the issue #32. However, to make it easier, we added a new property Best Regards, Jonathan |
Hi Jonathan,
I think that the problem encountered by #32 is simply that the fix to #19 was incomplete. HtmlNode.WriteAttribute also needs to be modified to use Entitize. David |
Hello @drbsoftware , Thank you ;) We try to do our best! Using the WebBrowser and some other HTML parser, you are right. The value should return However, the SetAttribute (using a WebBrowser) doesn't DeEntitize the value. Until we rewrite this library, I believe the best is to stay with the current behavior since a Way too much people are currently using the library with this behavior, so staying backward compatible is maybe more important in this case than doing the right thing. Best Regards, Jonathan |
The Value of attribute data-foo=""Hello"" should be "Hello", not "Hello"
I think the fix is:
The text was updated successfully, but these errors were encountered: