From 03207dea81fc4500c9df047de90083cf9af378c1 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sun, 16 Nov 2014 07:41:22 +0530 Subject: Hook up authentic click activation to the script task --- components/script/script_task.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'components/script/script_task.rs') diff --git a/components/script/script_task.rs b/components/script/script_task.rs index fdd4795ab25..acbd2cfbab3 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -18,8 +18,8 @@ use dom::bindings::trace::JSTraceable; use dom::bindings::utils::{wrap_for_same_compartment, pre_wrap}; use dom::document::{Document, HTMLDocument, DocumentHelpers, FromParser}; use dom::element::{Element, HTMLButtonElementTypeId, HTMLInputElementTypeId}; -use dom::element::{HTMLSelectElementTypeId, HTMLTextAreaElementTypeId, HTMLOptionElementTypeId}; -use dom::event::{Event, Bubbles, DoesNotBubble, Cancelable, NotCancelable}; +use dom::element::{HTMLSelectElementTypeId, HTMLTextAreaElementTypeId, HTMLOptionElementTypeId, ActivationElementHelpers}; +use dom::event::{Event, EventHelpers, Bubbles, DoesNotBubble, Cancelable, NotCancelable}; use dom::uievent::UIEvent; use dom::eventtarget::{EventTarget, EventTargetHelpers}; use dom::keyboardevent::KeyboardEvent; @@ -1018,8 +1018,11 @@ impl ScriptTask { Event::new(global::Window(*window), "click".to_string(), Bubbles, Cancelable).root(); - let eventtarget: JSRef = EventTargetCast::from_ref(node); - let _ = eventtarget.dispatch_event_with_target(None, *event); + // https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#trusted-events + event.set_trusted(true); + // https://html.spec.whatwg.org/multipage/interaction.html#run-authentic-click-activation-steps + let el = ElementCast::to_ref(node).unwrap(); // is_element() check already exists above + el.authentic_click_activation(*event); doc.commit_focus_transaction(); window.flush_layout(); -- cgit v1.2.3