Open OliverM opened 8 years ago
If I remember how kioo works correctly then this is caused by symbols in selector being resolved inside net.cgrand.enlive-html
- https://github.com/ckirkendall/kioo/blob/master/src/kioo/core.clj#L74-L75.
If your symbol isn't there it won't get resolved and you'll get a nil
which causes the NPE.
A possible fix would be to leave a symbol as-is if resolve-enlive-var
can't find it, for example like so:
(defn eval-selector [sel]
(reduce
(fn [sel-acc sel-frag]
(conj sel-acc
(cond
(list? sel-frag) (apply (resolve-enlive-var (first sel-frag)) (eval-selector (rest sel-frag)))
(or (vector? sel-frag)
(map? sel-frag)
(set? sel-frag)) (eval-selector sel-frag)
(symbol? sel-frag) (if [resolved-var (resolve-enlive-var sel-frag)]
resolved-var
sel-frag)
:else sel-frag)))
(cond
(vector? sel) []
(set? sel) #{}
(map? sel) {}
:else []) sel))
Feel free to clone kioo and see if it works. If that doesn't help then the maintainer would have to step in and offer a suggestion.
Custom selectors like the following work fine in Enlive but aren't supported in Kioo yet:
Attempting to use
text=
in a kioo selector currently gives a null-pointer error on compilation.