mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Move HTMLSelectElement upcast call into HTMLOptionsCollection constructor. Fixes #15521
This commit is contained in:
parent
357df35045
commit
7409031af2
2 changed files with 6 additions and 5 deletions
|
@ -16,6 +16,7 @@ use dom::bindings::str::DOMString;
|
|||
use dom::element::Element;
|
||||
use dom::htmlcollection::{CollectionFilter, HTMLCollection};
|
||||
use dom::htmloptionelement::HTMLOptionElement;
|
||||
use dom::htmlselectelement::HTMLSelectElement;
|
||||
use dom::node::{document_from_node, Node};
|
||||
use dom::window::Window;
|
||||
|
||||
|
@ -25,16 +26,16 @@ pub struct HTMLOptionsCollection {
|
|||
}
|
||||
|
||||
impl HTMLOptionsCollection {
|
||||
fn new_inherited(root: &Node, filter: Box<CollectionFilter + 'static>) -> HTMLOptionsCollection {
|
||||
fn new_inherited(select: &HTMLSelectElement, filter: Box<CollectionFilter + 'static>) -> HTMLOptionsCollection {
|
||||
HTMLOptionsCollection {
|
||||
collection: HTMLCollection::new_inherited(root, filter),
|
||||
collection: HTMLCollection::new_inherited(select.upcast(), filter),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new(window: &Window, root: &Node, filter: Box<CollectionFilter + 'static>)
|
||||
pub fn new(window: &Window, select: &HTMLSelectElement, filter: Box<CollectionFilter + 'static>)
|
||||
-> Root<HTMLOptionsCollection>
|
||||
{
|
||||
reflect_dom_object(box HTMLOptionsCollection::new_inherited(root, filter),
|
||||
reflect_dom_object(box HTMLOptionsCollection::new_inherited(select, filter),
|
||||
window,
|
||||
HTMLOptionsCollectionBinding::Wrap)
|
||||
}
|
||||
|
|
|
@ -243,7 +243,7 @@ impl HTMLSelectElementMethods for HTMLSelectElement {
|
|||
self.options.or_init(|| {
|
||||
let window = window_from_node(self);
|
||||
HTMLOptionsCollection::new(
|
||||
&window, self.upcast(), box OptionsFilter)
|
||||
&window, self, box OptionsFilter)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue