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

Support single quote attributes #116

Closed
joerdav opened this issue Jul 26, 2023 · 1 comment · Fixed by #125
Closed

Support single quote attributes #116

joerdav opened this issue Jul 26, 2023 · 1 comment · Fixed by #125

Comments

@joerdav
Copy link
Collaborator

joerdav commented Jul 26, 2023

Brought to my attention by @c-nv-s in the HTMX discord.

It is valid HTML to have single quote attributes, to make attributes that contain double quotes easier to write, https://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2

data-script='on click log "this uses double quotes in the attribute" end'
data-script="on click log 'this uses single quotes in the attribute' end"
data-script="on click log \"escaping does not work\" end"
@joerdav
Copy link
Collaborator Author

joerdav commented Jul 28, 2023

A workaround for this for now would be to use a go string literal:

data-script={`on click log "this uses double quotes in the attribute" end`}
data-script="on click log 'this uses single quotes in the attribute' end"

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

Successfully merging a pull request may close this issue.

1 participant