Skip to content

Commit

Permalink
implement HTMLDataListElement.options
Browse files Browse the repository at this point in the history
  • Loading branch information
lpy committed Mar 12, 2014
1 parent af616db commit a2189ee
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/components/script/dom/bindings/codegen/Bindings.conf
Expand Up @@ -138,7 +138,7 @@ addHTMLElement('HTMLBRElement')
addHTMLElement('HTMLCanvasElement')
addHTMLElement('HTMLDataElement')
addHTMLElement('HTMLDivElement')
addHTMLElement('HTMLDataListElement')
addHTMLElement('HTMLDataListElement', needsAbstract=['options'])
addHTMLElement('HTMLDirectoryElement')
addHTMLElement('HTMLDListElement')
addHTMLElement('HTMLElement')
Expand Down
12 changes: 6 additions & 6 deletions src/components/script/dom/htmldatalistelement.rs
Expand Up @@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use dom::bindings::codegen::HTMLDataListElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLDataListElementDerived;
use dom::bindings::codegen::InheritTypes::{HTMLDataListElementDerived, NodeCast};
use dom::bindings::js::JS;
use dom::document::Document;
use dom::element::HTMLDataListElementTypeId;
Expand Down Expand Up @@ -41,10 +41,10 @@ impl HTMLDataListElement {
}

impl HTMLDataListElement {
pub fn Options(&self) -> JS<HTMLCollection> {
// FIXME: https://github.com/mozilla/servo/issues/1842
let doc = self.htmlelement.element.node.owner_doc();
let doc = doc.get();
HTMLCollection::new(&doc.window, ~[])
pub fn Options(&self, abstract_self: &JS<HTMLDataListElement>) -> JS<HTMLCollection> {
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")
}
}
20 changes: 20 additions & 0 deletions src/test/content/test_document_datalist_options.html
@@ -0,0 +1,20 @@
<html>
<head>
<script src="harness.js"></script>
</head>
<datalist id="id">
<option value="A">
<option value="B">
<p>P</p>
<div>DIV</div>
<option value="C">
</datalist>
<script>
var datalist = document.getElementById("id");
is(datalist.options.length, 3);
is_a(datalist.options[0], HTMLOptionElement);
is_a(datalist.options[1], HTMLOptionElement);
is_a(datalist.options[2], HTMLOptionElement);
finish();
</script>
</html>

13 comments on commit a2189ee

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging lpy/servo/issue1842 = a2189ee into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lpy/servo/issue1842 = a2189ee merged ok, testing candidate = 4f1bad8

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging lpy/servo/issue1842 = a2189ee into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lpy/servo/issue1842 = a2189ee merged ok, testing candidate = aab408d

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging lpy/servo/issue1842 = a2189ee into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lpy/servo/issue1842 = a2189ee merged ok, testing candidate = 6270178

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 6270178

Please sign in to comment.