aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlinputelement.rs
diff options
context:
space:
mode:
authorRavi Shankar <wafflespeanut@gmail.com>2016-12-27 13:18:45 +0530
committerRavi Shankar <wafflespeanut@gmail.com>2016-12-27 15:57:34 +0530
commit5f0b3bd53c25c158117c91e9da36aaec0342244f (patch)
tree9fd5695a0f26f53d6e9f2a48bf7764d7c725b446 /components/script/dom/htmlinputelement.rs
parent08662cc64e0674b910c1579ca550afd77e559eca (diff)
downloadservo-5f0b3bd53c25c158117c91e9da36aaec0342244f.tar.gz
servo-5f0b3bd53c25c158117c91e9da36aaec0342244f.zip
Fire 'input' event after 'keypress' in input and textarea elements
Diffstat (limited to 'components/script/dom/htmlinputelement.rs')
-rwxr-xr-xcomponents/script/dom/htmlinputelement.rs25
1 files changed, 13 insertions, 12 deletions
diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs
index 8784c1f39df..d133efd5e14 100755
--- a/components/script/dom/htmlinputelement.rs
+++ b/components/script/dom/htmlinputelement.rs
@@ -1105,17 +1105,6 @@ impl VirtualMethods for HTMLInputElement {
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();
}
@@ -1126,7 +1115,19 @@ impl VirtualMethods for HTMLInputElement {
Nothing => (),
}
}
- }
+ } else if event.type_() == atom!("keypress") && !event.DefaultPrevented() &&
+ (self.input_type.get() == InputType::InputText ||
+ self.input_type.get() == InputType::InputPassword) {
+ 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);
+ }
+ }
}
}