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

HTML() loses it's class when added to non-HTML() strings #15

Open
cpsievert opened this issue Feb 4, 2022 · 1 comment
Open

HTML() loses it's class when added to non-HTML() strings #15

cpsievert opened this issue Feb 4, 2022 · 1 comment
Assignees
Milestone

Comments

@cpsievert
Copy link
Collaborator

cpsievert commented Feb 4, 2022

Currently when you concatenate HTML() strings with regular strings, the entire result will get escaped (because the HTML() class gets dropped.

>>> div(HTML("&") + " &")
<div>&amp; &amp;</div>

It seems most intuitive for the result to be:

>>> div(HTML("&") + " &")
<div>& &amp;</div>

but that also seems tricky/involved to implement.

(Note that you currently get similar behavior in attributes as well as children since we use + there as well)

@cpsievert
Copy link
Collaborator Author

Somewhat relatedly, it's bummer that this currently doesn't work

>>> div(" ".join([HTML("&"), HTML("&")]))
<div>&amp; &amp;</div>

@cpsievert cpsievert self-assigned this Jun 8, 2022
@cpsievert cpsievert added this to the Alpha release milestone Jun 8, 2022
schloerke added a commit that referenced this issue Apr 23, 2024
If a non-HTML value is added to an HTML value, the non-HTML value is escaped

Fixes #15
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

1 participant