Implement EventTarget::fire_simple_event and EventTarget::fire_simple_event_params

This commit is contained in:
Arthur Skobara 2015-12-20 12:52:28 +06:00
parent df087cc6cf
commit d38771e270
8 changed files with 61 additions and 71 deletions

View file

@ -15,7 +15,7 @@ use dom::bindings::js::{LayoutJS, Root};
use dom::bindings::refcounted::Trusted;
use dom::document::Document;
use dom::element::AttributeMutation;
use dom::event::{Event, EventBubbles, EventCancelable};
use dom::eventtarget::EventTarget;
use dom::htmlelement::HTMLElement;
use dom::node::{Node, NodeDamage, document_from_node, window_from_node};
use dom::virtualmethods::VirtualMethods;
@ -77,12 +77,7 @@ impl Runnable for ImageResponseHandlerRunnable {
// Fire image.onload
let window = window_from_node(document.r());
let event = Event::new(GlobalRef::Window(window.r()),
atom!("load"),
EventBubbles::DoesNotBubble,
EventCancelable::NotCancelable);
event.fire(element.upcast());
element.upcast::<EventTarget>().fire_simple_event("load", GlobalRef::Window(window.r()));
// Trigger reflow
window.add_pending_reflow();
}