Skip to content

Commit

Permalink
fixup! Implements HTMLDialogElement#close
Browse files Browse the repository at this point in the history
  • Loading branch information
clstl committed Aug 14, 2016
1 parent 2efc830 commit f152e3f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions components/script/dom/htmldialogelement.rs
Expand Up @@ -68,16 +68,22 @@ impl HTMLDialogElementMethods for HTMLDialogElement {
let target = self.upcast::<EventTarget>();
let win = window_from_node(self);

// Step 1
if !element.has_attribute(&atom!("open")) {
return Err(Error::InvalidState);
}

// Step 2
element.remove_attribute_by_name(&atom!("open"));

// Step 3
if let Some(new_value) = return_value {
*self.return_value.borrow_mut() = new_value;
}

// TODO: Step 4 implement pending dialog stack removal

// Step 5
win.dom_manipulation_task_source().queue_event(target, atom!("close"), EventBubbles::DoesNotBubble,
EventCancelable::NotCancelable, win.r());

Expand Down

0 comments on commit f152e3f

Please sign in to comment.