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

hiccup.core/h not backward-compatible #198

Closed
favila opened this issue Sep 14, 2022 · 1 comment
Closed

hiccup.core/h not backward-compatible #198

favila opened this issue Sep 14, 2022 · 1 comment

Comments

@favila
Copy link

favila commented Sep 14, 2022

When hiccup.core/h is used outside macro-evaluation in 2.0.0-alpha2, it's behavior is different from 1.x:

2.x:

(h "&&&")
=> "&&&"

1.x:

(h "&&&")
=> "&&&"

Since hiccup.core/h used to be a simple alias for escape-html and was no documented expectation (that I know of) that it must be inside an html dynamic context, code that would return hiccup fragments for later inclusion into a hiccup.core/html form is going to have its strings not-escaped.

I don't actually see how it's meaningful and safe to mix hiccup.core/h-using code (written with the assumption that it must escape on its own) with hiccup2.core/html macros--something is going to either not get escaped or get double-escaped.

Possibly this could delay the decision to escape by wrapping the to-string in raw instead? This still won't be the same behavior for those using h just to escape things and will still break code that inspects un-evaluated fragments, but it will make it do the right thing when it is eventually evaluated by either hiccup or hiccup2's html.

@favila favila mentioned this issue Sep 14, 2022
@weavejester
Copy link
Owner

The original idea was to allow swapping of hiccup.core/html for hiccup2.core/html without any other changes, but it probably makes more sense to deprecate h and restore its original behaviour.

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