aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/eventtarget.rs12
-rw-r--r--components/script/dom/htmlformelement.rs24
-rw-r--r--components/script/dom/htmlinputelement.rs16
-rw-r--r--components/script/dom/webidls/Event.webidl3
-rw-r--r--components/script/dom/websocket.rs8
5 files changed, 33 insertions, 30 deletions
diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs
index ae264060107..dc64b0dd4ad 100644
--- a/components/script/dom/eventtarget.rs
+++ b/components/script/dom/eventtarget.rs
@@ -332,15 +332,15 @@ impl EventTarget {
/// Implements https://html.spec.whatwg.org/multipage/#fire-a-simple-event
pub fn fire_simple_event(&self, name: &str, win: GlobalRef) -> Root<Event> {
- self.fire_simple_event_params(name, EventBubbles::DoesNotBubble,
- EventCancelable::NotCancelable, win)
+ self.fire_event(name, EventBubbles::DoesNotBubble,
+ EventCancelable::NotCancelable, win)
}
/// Implements more customizable variant of EventTarget::fire_simple_event.
- pub fn fire_simple_event_params(&self, name: &str,
- bubbles: EventBubbles,
- cancelable: EventCancelable,
- win: GlobalRef) -> Root<Event> {
+ pub fn fire_event(&self, name: &str,
+ bubbles: EventBubbles,
+ cancelable: EventCancelable,
+ win: GlobalRef) -> Root<Event> {
let event = Event::new(win, Atom::from(name), bubbles, cancelable);
event.fire(self);
diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs
index bb3e4a6bc2f..e957cda4199 100644
--- a/components/script/dom/htmlformelement.rs
+++ b/components/script/dom/htmlformelement.rs
@@ -172,10 +172,10 @@ impl HTMLFormElement {
// Step 5
if submit_method_flag == SubmittedFrom::NotFromFormSubmitMethod {
let event = self.upcast::<EventTarget>()
- .fire_simple_event_params("submit",
- EventBubbles::Bubbles,
- EventCancelable::Cancelable,
- GlobalRef::Window(win.r()));
+ .fire_event("submit",
+ EventBubbles::Bubbles,
+ EventCancelable::Cancelable,
+ GlobalRef::Window(win.r()));
if event.DefaultPrevented() {
return;
}
@@ -271,10 +271,10 @@ impl HTMLFormElement {
let win = window_from_node(self);
let unhandled_invalid_controls = invalid_controls.into_iter().filter_map(|field| {
let event = field.as_event_target()
- .fire_simple_event_params("invalid",
- EventBubbles::DoesNotBubble,
- EventCancelable::Cancelable,
- GlobalRef::Window(win.r()));
+ .fire_event("invalid",
+ EventBubbles::DoesNotBubble,
+ EventCancelable::Cancelable,
+ GlobalRef::Window(win.r()));
if !event.DefaultPrevented() { return Some(field); }
None
}).collect::<Vec<FormSubmittableElement>>();
@@ -398,10 +398,10 @@ impl HTMLFormElement {
let win = window_from_node(self);
let event = self.upcast::<EventTarget>()
- .fire_simple_event_params("reset",
- EventBubbles::Bubbles,
- EventCancelable::Cancelable,
- GlobalRef::Window(win.r()));
+ .fire_event("reset",
+ EventBubbles::Bubbles,
+ EventCancelable::Cancelable,
+ GlobalRef::Window(win.r()));
if event.DefaultPrevented() {
return;
}
diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs
index 5dd4309cc98..58d42c57201 100644
--- a/components/script/dom/htmlinputelement.rs
+++ b/components/script/dom/htmlinputelement.rs
@@ -866,14 +866,14 @@ impl Activatable for HTMLInputElement {
let win = window_from_node(self);
let target = self.upcast::<EventTarget>();
- target.fire_simple_event_params("input",
- EventBubbles::Bubbles,
- EventCancelable::NotCancelable,
- GlobalRef::Window(win.r()));
- target.fire_simple_event_params("change",
- EventBubbles::Bubbles,
- EventCancelable::NotCancelable,
- GlobalRef::Window(win.r()));
+ target.fire_event("input",
+ EventBubbles::Bubbles,
+ EventCancelable::NotCancelable,
+ GlobalRef::Window(win.r()));
+ target.fire_event("change",
+ EventBubbles::Bubbles,
+ EventCancelable::NotCancelable,
+ GlobalRef::Window(win.r()));
}
},
_ => ()
diff --git a/components/script/dom/webidls/Event.webidl b/components/script/dom/webidls/Event.webidl
index 3ce670bdaa2..7c7fa87bc14 100644
--- a/components/script/dom/webidls/Event.webidl
+++ b/components/script/dom/webidls/Event.webidl
@@ -8,6 +8,9 @@
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
+ *
+ * WebIDL specification for this interface:
+ * https://dom.spec.whatwg.org/#event
*/
[Constructor(DOMString type, optional EventInit eventInitDict)]
diff --git a/components/script/dom/websocket.rs b/components/script/dom/websocket.rs
index 73c488326c5..579c9466c2f 100644
--- a/components/script/dom/websocket.rs
+++ b/components/script/dom/websocket.rs
@@ -530,10 +530,10 @@ impl Runnable for CloseTask {
ws.full.set(false);
//A Bad close
ws.clean_close.set(false);
- ws.upcast().fire_simple_event_params("error",
- EventBubbles::DoesNotBubble,
- EventCancelable::Cancelable,
- global.r());
+ ws.upcast().fire_event("error",
+ EventBubbles::DoesNotBubble,
+ EventCancelable::Cancelable,
+ global.r());
}
let reason = ws.reason.borrow().clone();
/*In addition, we also have to fire a close even if error event fired