I've noticed you are doing side-effects in map
, which is not going to work because map
is lazy, i.e. it won't evaluate unless you try to use sequence it produces, which explains why it works in the REPL, but not in the browser.
For quickest and dirtiest fix, try using dorun
to force evaluation of your sequence: (dorun (map #(do ...... )
.
or, idiomatically, rewrite your code to something resembling this (which is not very idiomatic):
(doseq [[el cor-to-add] (map vector linguas-visiveis cores)]
(ef/at (str "#" el)
(ef/add-class cor-to-add))
(doseq [cor-to-remove (remove #{cor} cores)]
(ef/at (str "#" el)
(ef/remove-class cor-to-remove)))
)
or this, removing all classes from every element, first:
(doseq [el linguas-visiveis
cor cores]
(ef/at (str "#" el)
(ef/remove-class cor)))
and adding only required classes later:
(doseq [[el cor] (map vector linguas-visiveis cores)]
(ef/at (str "#" el)
(ef/add-class cor)))