Fire 'input' event after 'keypress' in input and textarea elements

This commit is contained in:
Ravi Shankar 2016-12-27 13:18:45 +05:30
parent 08662cc64e
commit 5f0b3bd53c
4 changed files with 24 additions and 24 deletions

View file

@ -403,17 +403,6 @@ impl VirtualMethods for HTMLTextAreaElement {
KeyReaction::DispatchInput => {
self.value_changed.set(true);
self.update_placeholder_shown_state();
if event.IsTrusted() {
let window = window_from_node(self);
let _ = window.user_interaction_task_source().queue_event(
&self.upcast(),
atom!("input"),
EventBubbles::Bubbles,
EventCancelable::NotCancelable,
&window);
}
self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
event.mark_as_handled();
}
@ -424,6 +413,16 @@ impl VirtualMethods for HTMLTextAreaElement {
KeyReaction::Nothing => (),
}
}
} else if event.type_() == atom!("keypress") && !event.DefaultPrevented() {
if event.IsTrusted() {
let window = window_from_node(self);
let _ = window.user_interaction_task_source()
.queue_event(&self.upcast(),
atom!("input"),
EventBubbles::Bubbles,
EventCancelable::NotCancelable,
&window);
}
}
}
}