Listen on Editor for bubbled textInput events instead of directly on hidden input

This commit is contained in:
Corey Johnson & Nathan Sobo
2012-04-19 10:14:45 -06:00
parent d768f1a50f
commit 49b5263fd7
2 changed files with 7 additions and 4 deletions

View File

@@ -125,6 +125,9 @@ $.fn.attachToDom = ->
$('#jasmine-content').append(this)
$.fn.textInput = (data) ->
event = document.createEvent 'TextEvent'
event.initTextEvent('textInput', true, true, window, data)
this.each -> this.dispatchEvent(event)
this.each ->
event = document.createEvent('TextEvent')
event.initTextEvent('textInput', true, true, window, data)
event = jQuery.event.fix(event)
$(this).trigger(event)

View File

@@ -186,7 +186,7 @@ class Editor extends View
@selectOnMousemoveUntilMouseup()
@hiddenInput.on "textInput", (e) =>
@on "textInput", (e) =>
@insertText(e.originalEvent.data)
@scroller.on 'scroll', =>