Auto merge of #9074 - dagnir:ask-for-reset-on-remove, r=nox

Ask for reset when option is removed.

Now that `UnbindContext` is available, asking the `select` element for a reset when an option is removed is now possible.

Link to the spec: https://html.spec.whatwg.org/multipage/#ask-for-a-reset

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9074)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-12-29 16:43:32 +05:30
commit e7212953f1
2 changed files with 6 additions and 5 deletions

View file

@ -210,6 +210,12 @@ impl VirtualMethods for HTMLOptionElement {
fn unbind_from_tree(&self, context: &UnbindContext) {
self.super_type().unwrap().unbind_from_tree(context);
if let Some(select) = context.parent.inclusive_ancestors()
.filter_map(Root::downcast::<HTMLSelectElement>)
.next() {
select.ask_for_reset();
}
let node = self.upcast::<Node>();
let el = self.upcast::<Element>();
if node.GetParentNode().is_some() {