Get updates

Scott Event Handler Naming Conflict with jQuery

I’m trying out Spine (and CoffeeScript) and encountered a problem setting up event handlers with my controller. Turned out to be caused by my choice of an event handler name.

In my controller I opted for the delegation shortcut, almost straight out of the Spine Controller docs:

  'click .tab': 'click'

click: (event) ->

This delegates click events on @el with the .tab selector to the ‘click’ handler method. jQuery (1.7.1) seems to get confused by this and throws an error during event dispatch (when click is triggered: “TypeError: ‘jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) .apply’ is not a function”)

The solution? Rename the handler to avoid conflict:

  'click .tab': 'clickHandler'

clickHandler: (event) ->

Leave a Reply

Fatal error: Uncaught Error: Call to undefined function show_subscription_checkbox() in /home/dmetro/ Stack trace: #0 /home/dmetro/ require() #1 /home/dmetro/ comments_template() #2 /home/dmetro/ include('/home/dmetro/3d...') #3 /home/dmetro/ require_once('/home/dmetro/3d...') #4 /home/dmetro/ require('/home/dmetro/3d...') #5 {main} thrown in /home/dmetro/ on line 90