aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlelement.rs
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2014-11-24 20:12:17 +0530
committerManish Goregaokar <manishsmail@gmail.com>2014-12-05 18:33:03 -0800
commitc89ec3910f15f3a71be66d60da5cfd9aed1b30f1 (patch)
tree97546eded2fd8a314969e67721d689a39d52900a /components/script/dom/htmlelement.rs
parente68119f82f4b0684918a76299d115b86285be97b (diff)
downloadservo-c89ec3910f15f3a71be66d60da5cfd9aed1b30f1.tar.gz
servo-c89ec3910f15f3a71be66d60da5cfd9aed1b30f1.zip
Hook up synthetic click activation to script_task and <>.click()
Diffstat (limited to 'components/script/dom/htmlelement.rs')
-rw-r--r--components/script/dom/htmlelement.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs
index 75ad910ee2e..728f0ee573d 100644
--- a/components/script/dom/htmlelement.rs
+++ b/components/script/dom/htmlelement.rs
@@ -7,14 +7,15 @@ use dom::attr::AttrHelpers;
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
use dom::bindings::codegen::Bindings::HTMLElementBinding;
use dom::bindings::codegen::Bindings::HTMLElementBinding::HTMLElementMethods;
+use dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementMethods;
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLFrameSetElementDerived};
-use dom::bindings::codegen::InheritTypes::EventTargetCast;
+use dom::bindings::codegen::InheritTypes::{EventTargetCast, HTMLInputElementCast};
use dom::bindings::codegen::InheritTypes::{HTMLElementDerived, HTMLBodyElementDerived};
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::utils::{Reflectable, Reflector};
use dom::document::Document;
-use dom::element::{Element, ElementTypeId, ElementTypeId_, HTMLElementTypeId};
+use dom::element::{Element, ElementTypeId, ElementTypeId_, HTMLElementTypeId, ActivationElementHelpers};
use dom::eventtarget::{EventTarget, EventTargetHelpers, NodeTargetTypeId};
use dom::node::{Node, ElementNodeTypeId, window_from_node};
use dom::virtualmethods::VirtualMethods;
@@ -91,6 +92,17 @@ impl<'a> HTMLElementMethods for JSRef<'a, HTMLElement> {
win.SetOnload(listener)
}
}
+
+ // https://html.spec.whatwg.org/multipage/interaction.html#dom-click
+ fn Click(self) {
+ let maybe_input = HTMLInputElementCast::to_ref(self);
+ match maybe_input {
+ Some(i) if i.Disabled() => return,
+ _ => ()
+ }
+ let element: JSRef<Element> = ElementCast::from_ref(self);
+ element.as_maybe_activatable().map(|a| a.synthetic_click_activation(false, false, false, false));
+ }
}
impl<'a> VirtualMethods for JSRef<'a, HTMLElement> {