lambdaisland / lambdaisland/ornament

Defstyled component is not properly handling children when some of them are fragments with `unsafe-html`

Open
#30 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Clojure
Stars
137
Forks
13
PR merge metrics
No merged PRs in 30d

Description

Reverted to 661281f5aa7682cc4cb34a836e783ccb4841cda8 and it works as expected.

In my case i was rendering handlebars html.

Test case is something like:

(o/defstyled myelem :div)

 [:<>
   [:div.before-custom-elem]
   [myelem
    [:div.before-unsafe]
    [:<>
     [::hiccup/unsafe-html "{{open handlebars tag}}"]
     [:div.inside-unsafe]
     [::hiccup/unsafe-html "{{close handlebars tag}}"]]
    [:div.after-unsafe]]
   [:div.after-custom-elem]]

[:div.after-unsafe] was disappearing when rendering html.

Rendered to html with latest lambdaisland.hiccup
Wanted to get this out there asap because this can silently break rendered html.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction in issue #30 and compare current rendering with commit 661281f5aa7682cc4cb34a836e783ccb4841cda8, using the latest lambdaisland.hiccup. Trace Defstyled rendering when fragments contain hiccup/unsafe-html and verify that the children after the unsafe fragment are preserved in the rendered HTML.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.