     Blaze.Template._withTemplateInstanceFunc templateFunc, ->
       Blaze._wrapCatchingExceptions(f, 'template helper').apply self, args
 
-viewToTemplateInstance = (view) ->
-  # We skip contentBlock views which are injected by Meteor when using
-  # block helpers (in addition to block helper view). This matches more
-  # the visual structure of templates and not the internal implementation.
-  while view and (not view.template or view.name is '(contentBlock)' or view.name is '(elseBlock)')
-    view = view.originalParentView or view.parentView
-
-  # Body view has template field, but not templateInstance. We return null in that case.
-  return null unless view?.templateInstance
-
-  _.bind view.templateInstance, view
-
 addEvents = (view, component) ->
   eventsList = component.events()
 

          event = args[0]

          currentView = Blaze.getView event.currentTarget
          templateInstance = viewToTemplateInstance currentView

          if Template._withTemplateInstanceFunc
            withTemplateInstanceFunc = Template._withTemplateInstanceFunc

    templateInstance = getTemplateInstance templateInstance.view.parentView

  null

getTemplateInstanceFunction = (view) ->
  templateInstance = getTemplateInstance view
  ->
    templateInstance

class ComponentsNamespaceReference
  constructor: (@namespace, @templateInstance) ->
