Skip to content
Permalink
Browse files

Add fixes based on review.

- Whitespace and indentation issues

- call as_for_reset on option insert

- add link to 'pick' in standard
  • Loading branch information...
dagnir committed Oct 27, 2015
1 parent 15a8b6b commit 92e008307fe810ff9762d98b261e88f2040d1d5c
Showing with 12 additions and 11 deletions.
  1. +10 −10 components/script/dom/htmloptionelement.rs
  2. +2 −1 components/script/dom/htmlselectelement.rs
@@ -140,11 +140,11 @@ impl HTMLOptionElementMethods for HTMLOptionElement {
self.dirtiness.set(true);
self.selectedness.set(selected);
if let Some(select) = self.upcast::<Node>().ancestors()
.filter_map(Root::downcast::<HTMLSelectElement>).next() {
if selected {
select.pick_option(self);
}
select.ask_for_reset();
.filter_map(Root::downcast::<HTMLSelectElement>).next() {
if selected {
select.pick_option(self);
}
select.ask_for_reset();
}
}
}
@@ -198,13 +198,13 @@ impl VirtualMethods for HTMLOptionElement {

self.upcast::<Element>().check_parent_disabled_state_for_option();

if self.Selected() {
let node = self.upcast::<Node>();
if let Some(select) = node.ancestors()
.filter_map(Root::downcast::<HTMLSelectElement>)
.next() {
if let Some(select) = self.upcast::<Node>().ancestors()
.filter_map(Root::downcast::<HTMLSelectElement>)
.next() {
if self.Selected() {
select.pick_option(self);
}
select.ask_for_reset();
}
}

@@ -64,7 +64,7 @@ impl HTMLSelectElement {
opt.set_selectedness(false);
last_selected = Some(Root::from_ref(opt.r()));
}
let element = opt.upcast::<Element>();
let element = opt.upcast::<Element>();
if first_enabled.is_none() && !element.get_disabled_state() {
first_enabled = Some(Root::from_ref(opt.r()));
}
@@ -82,6 +82,7 @@ impl HTMLSelectElement {
}
}

// https://html.spec.whatwg.org/multipage/#concept-select-pick
pub fn pick_option(&self, picked: &HTMLOptionElement) {
if !self.Multiple() {
let node = self.upcast::<Node>();

0 comments on commit 92e0083

Please sign in to comment.
You can’t perform that action at this time.