Is :ul#mytag.myclass
a valid tag, but :ul.myclass#mytag
not? Is there a reason for this?
Reagent is based on Weavejester's Hiccup. This is the relevant line in the original code: https://github.com/weavejester/hiccup/blob/master/src/hiccup/compiler.clj#L61
Thinking about it now, I would probably implement it the same way (although I try not to use this sugar myself). Much easier to parse and a bit easier to read Hiccup that adheres to a single cohesive style.
Gotcha. Thanks!
That's one dense regexp.
> although I try not to use this sugar myself
You'd write it as [:ul {:class "myclass" :id "mytag"}]
? The visual separation does make it a bit easier on the eyes.
If you replace strings with keywords it becomes even better. Especially if your development environment highlights usages of the same keyword and can search for them across multiple files. It also makes it possible to have conditional classes and IDs while maintaining the same style across the whole codebase.
BTW in Reagent, you can go nuts with classes:
[:div {:class [:a :b (when add-c? :c)]} ...]
> replace strings with keywords Huh, I like that. It's almost like you can refactor CSS!
I gotta get some sleep. Thanks for your advice!