mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Support live HTMLCollection for DataListElement.options
This commit is contained in:
parent
9038f21026
commit
7f5b3690f3
1 changed files with 11 additions and 6 deletions
|
@ -6,11 +6,11 @@ use dom::bindings::codegen::HTMLDataListElementBinding;
|
|||
use dom::bindings::codegen::InheritTypes::{HTMLDataListElementDerived, NodeCast};
|
||||
use dom::bindings::js::JS;
|
||||
use dom::document::Document;
|
||||
use dom::element::HTMLDataListElementTypeId;
|
||||
use dom::element::{Element, HTMLDataListElementTypeId};
|
||||
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
|
||||
use dom::htmlcollection::HTMLCollection;
|
||||
use dom::htmlcollection::{HTMLCollection, CollectionFilter};
|
||||
use dom::htmlelement::HTMLElement;
|
||||
use dom::node::{Node, ElementNodeTypeId};
|
||||
use dom::node::{Node, ElementNodeTypeId, window_from_node};
|
||||
use servo_util::str::DOMString;
|
||||
|
||||
#[deriving(Encodable)]
|
||||
|
@ -42,9 +42,14 @@ impl HTMLDataListElement {
|
|||
|
||||
impl HTMLDataListElement {
|
||||
pub fn Options(&self, abstract_self: &JS<HTMLDataListElement>) -> JS<HTMLCollection> {
|
||||
struct HTMLDataListOptionsFilter;
|
||||
impl CollectionFilter for HTMLDataListOptionsFilter {
|
||||
fn filter(&self, elem: &JS<Element>, _root: &JS<Node>) -> bool {
|
||||
elem.get().tag_name == ~"option"
|
||||
}
|
||||
}
|
||||
let node: JS<Node> = NodeCast::from(abstract_self);
|
||||
let doc = &self.htmlelement.element.node.owner_doc();
|
||||
let window = &doc.get().window;
|
||||
HTMLCollection::by_tag_name(window, &node, ~"option")
|
||||
let filter = ~HTMLDataListOptionsFilter;
|
||||
HTMLCollection::create_live(&window_from_node(&node), &node, filter)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue