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

Encoding in HtmlAttributeValueHelpers breaks Third Party JS #169

Open
mclausing opened this issue May 1, 2024 · 1 comment
Open

Encoding in HtmlAttributeValueHelpers breaks Third Party JS #169

mclausing opened this issue May 1, 2024 · 1 comment

Comments

@mclausing
Copy link

I'm using a third party .net/js library which sticks json in to a data- attribute on a div and then uses it to hydrate. The HtmlAttributeValueHelpers.Encode method seems to break the Javascript. I'm not positive which character replacement causes it, but my guess is ". It would be great to either have a setting to disable/enable this, or allow for some dependency injection with our own service, or have a way to ignore certain fields.

As it stands there is no easy way to do this, and I worked around it by disabling for my path/request.

@Taritsyn
Copy link
Owner

Taritsyn commented May 1, 2024

Hello, Michael!

I'm using a third party .net/js library which sticks json in to a data- attribute on a div and then uses it to hydrate. The HtmlAttributeValueHelpers.Encode method seems to break the Javascript.

Could you give a specific example: name of .NET/JS library, error message, HTML code before and after minification.

I'm not positive which character replacement causes it, but my guess is ".

It might make sense for you to experiment with the AttributeQuotesStyle setting (see the “HTML Minifier” section documentation). You can use the WebMarkupMin Online site to experiment with HTML code.

For now, as a temporary solution, you can wrap this div in a ignoring comment tag.

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