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/json: shows #ZgotmplZ in a custom attribute with name "data-data" but not with "data-go" #12648

emilgpa opened this Issue Sep 16, 2015 · 2 comments


None yet
4 participants

emilgpa commented Sep 16, 2015

The error occurs when marshal a struct in a HTML inside of a custom attribute with name data-data but not with other name (for example, data-go)

@ianlancetaylor ianlancetaylor changed the title from shows #ZgotmplZ in a custom attribute with name "data-data" but not with "data-go" to encoding/json: shows #ZgotmplZ in a custom attribute with name "data-data" but not with "data-go" Sep 16, 2015

@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Sep 16, 2015


This comment has been minimized.


nussjustin commented Nov 26, 2017

I took a look this since I'm currently playing with the html/template package.

When checking the type of known attributes the html/template package removes "data-" prefixes so it can handle things like data-href or data-src as URLs or prevent unsafe values for fields like data-method. So data-data becomes only data (at least for the type checking). Since data is a known attribute used to specify the URLs for <object>'s the parser treats it, and thus data-data, as URL.

So I'd say this works as intended. But we should at least update the documentation to state that data-* attributes and attributes with namespaces are handled as if they had no data- prefix / namespace.


This comment has been minimized.

gopherbot commented Nov 26, 2017

Change mentions this issue: html/template: document handling of namespaced and data- attributes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment