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:

events:
  '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:

events:
  'click .tab': 'clickHandler'

clickHandler: (event) ->
  ...

Leave a Reply


Fatal error: Uncaught Error: Call to undefined function show_subscription_checkbox() in /home/dmetro/3dmdesign.com/wp-content/themes/hex_columns/comments.php:90 Stack trace: #0 /home/dmetro/3dmdesign.com/wp-includes/comment-template.php(1472): require() #1 /home/dmetro/3dmdesign.com/wp-content/themes/hex_columns/single.php(65): comments_template() #2 /home/dmetro/3dmdesign.com/wp-includes/template-loader.php(74): include('/home/dmetro/3d...') #3 /home/dmetro/3dmdesign.com/wp-blog-header.php(19): require_once('/home/dmetro/3d...') #4 /home/dmetro/3dmdesign.com/index.php(17): require('/home/dmetro/3d...') #5 {main} thrown in /home/dmetro/3dmdesign.com/wp-content/themes/hex_columns/comments.php on line 90