 					null
 
 				setCurrent = (direction) ->
+					return unless $ul[0].getElementsByClassName("show")[0]
 					if currentEl
 						currentEl.className = "show"
 						oldCurrentEl = currentEl

					null
				select = (el) ->
					$input.val(el.innerHTML).triggerHandler("input")
					$lis.addClass "hide"
				scope.typeaheadKeydown = (evt) ->
					switch evt.which
						when 38 # top


	res =
		template: """
		<div><div ng-keydown="typeaheadKeydown($event)" ng-keyup="typeaheadKeyup($event)"><input ng-model="term" type="text" autocomplete="off" /><div ng-click="typeaheadSelect($event)"><div ng-transclude></div></div></div></div>
		"""
		scope: true
		transclude: true
