Implement ask_for_reset for HTMLSelectElement.

Fixes #7774
This commit is contained in:
Dongie Agnir 2015-10-06 17:38:39 -10:00
parent ac8097b5d2
commit b1d6b0f797
4 changed files with 135 additions and 2 deletions

View file

@ -14,6 +14,7 @@ use dom::document::Document;
use dom::element::{AttributeMutation, Element, IN_ENABLED_STATE};
use dom::htmlelement::HTMLElement;
use dom::htmlscriptelement::HTMLScriptElement;
use dom::htmlselectelement::HTMLSelectElement;
use dom::node::Node;
use dom::text::Text;
use dom::virtualmethods::VirtualMethods;
@ -51,6 +52,10 @@ impl HTMLOptionElement {
let element = HTMLOptionElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLOptionElementBinding::Wrap)
}
pub fn set_selectedness(&self, selected: bool) {
self.selectedness.set(selected);
}
}
fn collect_text(element: &Element, value: &mut DOMString) {
@ -134,8 +139,10 @@ impl HTMLOptionElementMethods for HTMLOptionElement {
fn SetSelected(&self, selected: bool) {
self.dirtiness.set(true);
self.selectedness.set(selected);
// FIXME: as per the spec, implement 'ask for a reset'
// https://github.com/servo/servo/issues/7774
if let Some(select) = self.upcast::<Node>().ancestors()
.filter_map(Root::downcast::<HTMLSelectElement>).next() {
select.ask_for_reset();
}
}
}