mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Remove "fire a simple event" concept, refactor event firing API.
"fire a simple event" concept was removed in https://github.com/whatwg/html/pull/1933.
This commit is contained in:
parent
5b4cc9568d
commit
c3b279a4c3
15 changed files with 58 additions and 52 deletions
|
@ -490,21 +490,42 @@ impl EventTarget {
|
|||
!self.handlers.borrow().is_empty()
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#fire-a-simple-event
|
||||
pub fn fire_simple_event(&self, name: &str) -> Root<Event> {
|
||||
self.fire_event(name, EventBubbles::DoesNotBubble,
|
||||
EventCancelable::NotCancelable)
|
||||
// https://dom.spec.whatwg.org/#concept-event-fire
|
||||
pub fn fire_event(&self, name: &str) -> Root<Event> {
|
||||
self.fire_event_with_params(name,
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::NotCancelable)
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-event-fire
|
||||
pub fn fire_event(&self, name: &str,
|
||||
bubbles: EventBubbles,
|
||||
cancelable: EventCancelable)
|
||||
-> Root<Event> {
|
||||
pub fn fire_bubbling_event(&self, name: &str) -> Root<Event> {
|
||||
self.fire_event_with_params(name,
|
||||
EventBubbles::Bubbles,
|
||||
EventCancelable::NotCancelable)
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-event-fire
|
||||
pub fn fire_cancelable_event(&self, name: &str) -> Root<Event> {
|
||||
self.fire_event_with_params(name,
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::Cancelable)
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-event-fire
|
||||
pub fn fire_bubbling_cancelable_event(&self, name: &str) -> Root<Event> {
|
||||
self.fire_event_with_params(name,
|
||||
EventBubbles::Bubbles,
|
||||
EventCancelable::Cancelable)
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-event-fire
|
||||
pub fn fire_event_with_params(&self,
|
||||
name: &str,
|
||||
bubbles: EventBubbles,
|
||||
cancelable: EventCancelable)
|
||||
-> Root<Event> {
|
||||
let event = Event::new(&self.global(), Atom::from(name), bubbles, cancelable);
|
||||
|
||||
event.fire(self);
|
||||
|
||||
event
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue