Creighton, this is really excellent feedback and exactly what I was
hoping for.  I am relatively new to Enfocus and had a feeling I could
have written that code in a more idiomatic way.  I'll edit the piece to
incorporate your suggestions ASAP.

Many thanks!

DD

(2013/12/12 23:00), Creighton Kirkendall wrote:
> Nice job! 
> 
> I noticed a few small things on the Enfocus section that I would tweak but 
> nothing that really makes all that big a difference.  I listed a few below.
> 
> You don't need to reference js/document when doing a single selector and you 
> don't need the [] around the selector.
> 
> (ef/at js/document ["#menu ul"] (ef/append li))
> 
> is equivalent to 
> 
> (ef/at "#menu ul" (ef/append li))
> 
> Enfocus is generally about chaining transforms and your add listener could be 
> seen as a custom transform.  With this in mind, I might recommend something 
> closer to this.   
> 
> (defn add-annoying-alert-listener_enfocus! []
>   (ef-events/listen
>      :click
>      (fn [evt]
>        (let [atxt (-> evt (.-currentTarget) (.-text))
>              msg  (str "You clicked " atxt)]
>          (.alert js/window msg)
>          (.preventDefault evt)))))
> 
> 
> (defn add-menu-link_enfocus!
>   [link]
>   (let [link-str (-> link first name capitalize)
>         href     (last link)
>         li       (ef/html [:li [:a {:href href} link-str]])]
>     (ef/at 
>       "#menu ul" (ef/append li)
>       (str "a[href=" href "]") (add-annoying-alert-listener_enfocus!))))
> 
> 
> CK
>  
> 
> On Thursday, December 12, 2013 8:34:53 AM UTC-5, David Della Costa wrote:
>> Apologies...I messed something up temporarily fixing the issue Luke
>>
>> Morton found.  Is it still broken for you?
>>
>>
>>
>> (2013/12/12 22:33), Creighton Kirkendall wrote:
>>
>>> I seem to be getting a 404 on the link now.
>>
>>>
> 

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to