       @enabled = !@enabled
 
     toggle: (e) ->
-      self = this
+      self = @
       if e
         self = $(e.currentTarget).data('bs.' + @type)
         if !self


  $.fn.tooltip = (option) ->
    @each ->
      $this   = $(@)
      data    = $this.data('bs.tooltip')
      options = typeof option == 'object' and option

      return if !data and option == 'destroy'
      $this.data('bs.tooltip', (data = new Tooltip(@, options))) if !data
      data[option]() if typeof option == 'string'

  old = $.fn.tooltip

  $.fn.tooltip.Constructor = Tooltip

  $.fn.tooltip.noConflict = ->
    $.fn.tooltip = old
    @

  $.fn.tooltip.defaults =
    animation: true
    placement: 'top'
    selector: false
    template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
    trigger: 'hover focus'
    title: ''
    delay: 0

      @arrow().css(position, if delta then (50 * (1 - delta / dimension) + '%') else '')

    setContent: ->
      @tip().find('.inner')[if @options.html then 'html' else 'text'](@getTitle()).removeClass('fade in top bottom left right')

    hide: ->
      that = @
