     useDocumentBottom = false
     unregisterEventListener = null
     checkInterval = false
+    lineHeight = 0
 
     height = (elem) ->
       elem = elem[0] or elem

      remaining = elementBottom - containerBottom
      shouldScroll = remaining <= height(container) * scrollDistance + 1

      if shouldScroll
        checkWhenEnabled = true

        if scrollEnabled
          if scope.$$phase || $rootScope.$$phase
            scope.infiniteScroll()
          else
            scope.$apply(scope.infiniteScroll)
      else
        if checkInterval then $interval.cancel checkInterval
        checkWhenEnabled = false

    infiniteScrollContainer: '='
    infiniteScrollDistance: '='
    infiniteScrollDisabled: '='
    infiniteScrollUseDocumentBottom: '='
    infiniteScrollListenForEvent: '@'
    infiniteScrollLineHeight: '='
    infiniteScrollCallback: '='

  link: (scope, elem, attrs) ->
    windowElement = angular.element($window)
