Fork me on GitHub
#hoplon
<
2017-11-17
>
opyate16:11:22

Happy Friday, all. I had a look at the "special cases" doc, but wasn't enlightened. I have a formula cell foo which just evaluates to a String, which I'm using like this:

(cond-tpl 
  foo (td :class foo (span foo))
  :else
  (etc))
But the class attribute ends up being multi-valued (i.e. some other things in the outer-level collection being looped)

opyate16:11:53

Changing it to :class (cell= {foo true}) loops fewer of the outer-loop stuff, although it is accurate on the class attribute

alandipert16:11:48

ah yes, this is a thing that pops up from time to time

alandipert16:11:04

the problem is that :class doesn't remove previously added classes, only adds them

alandipert16:11:08

but you can experiment with it by making your own attribute and doing the jquery you want inside it

opyate16:11:19

will do, thanks for the reply

alandipert16:11:01

opyate are you familiar w/ mulimethods or do!/on! in particular?

opyate16:11:33

multimethods, yes - haven't looked at implementations of do!/on!

opyate16:11:26

your link is my first time looking at the code

alandipert16:11:30

cool. there's not a whole lot to know, but when you know it you know like 50% of hoplon underbelly

alandipert16:11:21

basically do! is a multimethod for implementing ways for cells to influence elements, and on! is the way to attach events from elements to cljs functions (:click, :hover etc)

alandipert16:11:58

adding your own is a dimension on which you can specialize your app to a particular target platform (mobile) or to build your own layout language atop html

opyate16:11:59

ok, I'll try and figure out why toggleClass has baggage for a brand new element

flyboarder18:11:42

@opyate I’m not sure exactly what your issue is with the hash-map version of :class, also which version are you using?