mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Move the CloseEventInit defaults into IDL.
This commit is contained in:
parent
692fc09041
commit
94b3617629
2 changed files with 5 additions and 12 deletions
|
@ -15,8 +15,6 @@ use script_task::ScriptChan;
|
|||
|
||||
use util::str::DOMString;
|
||||
|
||||
use std::borrow::ToOwned;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct CloseEvent {
|
||||
event: Event,
|
||||
|
@ -57,15 +55,10 @@ impl CloseEvent {
|
|||
type_: DOMString,
|
||||
init: &CloseEventBinding::CloseEventInit)
|
||||
-> Fallible<Temporary<CloseEvent>> {
|
||||
let clean_status = init.wasClean.unwrap_or(true);
|
||||
let cd = init.code.unwrap_or(0);
|
||||
let rsn = match init.reason.as_ref() {
|
||||
Some(reason) => reason.clone(),
|
||||
None => "".to_owned(),
|
||||
};
|
||||
let bubbles = if init.parent.bubbles { EventBubbles::Bubbles } else { EventBubbles::DoesNotBubble };
|
||||
let cancelable = if init.parent.cancelable { EventCancelable::Cancelable } else { EventCancelable::NotCancelable };
|
||||
Ok(CloseEvent::new(global, type_, bubbles, cancelable, clean_status, cd, rsn))
|
||||
Ok(CloseEvent::new(global, type_, bubbles, cancelable, init.wasClean,
|
||||
init.code, init.reason.clone()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ interface CloseEvent : Event {
|
|||
};
|
||||
|
||||
dictionary CloseEventInit : EventInit {
|
||||
boolean wasClean;
|
||||
unsigned short code;
|
||||
DOMString reason;
|
||||
boolean wasClean = true;
|
||||
unsigned short code = 0;
|
||||
DOMString reason = "";
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue