Skip to content

Instantly share code, notes, and snippets.

@paulkoegel
Last active May 17, 2019 21:22
Show Gist options
  • Save paulkoegel/cc14431f58bedfc1899ea33b1853144b to your computer and use it in GitHub Desktop.
Save paulkoegel/cc14431f58bedfc1899ea33b1853144b to your computer and use it in GitHub Desktop.
;loaded from gist: https://gist.github.com/paulkoegel/cc14431f58bedfc1899ea33b1853144b
(ns instructions.core
(:require [reagent.core :as reagent]
[re-frame.core :as re-frame]))
(defn parent [& children]
[:div
[:h1 "Parent"]
children])
(defn info []
[:div
[parent
;; THIS BREAKS:
[:.tac "This breaks"]
;; THIS WOULD WORK:
#_[:div.tac "This works"]]
])
;; root of the error:
;; https://github.com/reagent-project/reagent/blob/88e9833be9c3135548d760286ffd84d88a0a0489/src/reagent/impl/template.cljs#L263-L273
;; the `re-tag` regex doesn't match `:.tac` but `:div.tac`:
;; (re-matches #"([^\s\.#]+)(?:#([^\s\.#]+))?(?:\.([^\s#]+))?" (name :.tag))
;; => nil
;; (re-matches #"([^\s\.#]+)(?:#([^\s\.#]+))?(?:\.([^\s#]+))?" (name :div.tac))
;; => ["div.tac" "div" nil "tac"]
(reagent/render
[info]
(js/document.getElementById "app"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment