modal selector cleans up after itself

This commit is contained in:
Chris Wanstrath
2011-11-13 01:55:00 -08:00
parent 92773e379a
commit b5092c88d1

View File

@@ -32,7 +32,7 @@ class ModalSelector extends Modal
style.appendChild rules
head.appendChild style
$('#modal-selector input').live 'keydown', @onKeydown
$('#modal-selector input').live 'keydown.modal-selector', @onKeydown
onKeydown: (e) =>
keys = up: 38, down: 40, enter: 13
@@ -51,6 +51,10 @@ class ModalSelector extends Modal
super
@filter()
hide: ->
super
$(document).unbind '.modal-selector'
filter: ->
if query = $('#modal-selector input').val()
items = @findMatchingItems query