Implement HTMLLIElement#value

This commit is contained in:
vrod 2016-07-26 22:40:19 -03:00
parent 1f34d4f219
commit defaa5bee7
7 changed files with 46 additions and 217 deletions

View file

@ -3,12 +3,16 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLLIElementBinding;
use dom::bindings::codegen::Bindings::HTMLLIElementBinding::HTMLLIElementMethods;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::Root;
use dom::bindings::str::DOMString;
use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom::virtualmethods::VirtualMethods;
use string_cache::Atom;
use style::attr::AttrValue;
#[dom_struct]
pub struct HTMLLIElement {
@ -31,3 +35,24 @@ impl HTMLLIElement {
HTMLLIElementBinding::Wrap)
}
}
impl HTMLLIElementMethods for HTMLLIElement {
// https://html.spec.whatwg.org/multipage/#dom-li-value
make_int_getter!(Value, "value");
// https://html.spec.whatwg.org/multipage/#dom-li-value
make_int_setter!(SetValue, "value");
}
impl VirtualMethods for HTMLLIElement {
fn super_type(&self) -> Option<&VirtualMethods> {
Some(self.upcast::<HTMLElement>() as &VirtualMethods)
}
fn parse_plain_attribute(&self, name: &Atom, value: DOMString) -> AttrValue {
match name {
&atom!("value") => AttrValue::from_i32(value.into(), 0),
_ => self.super_type().unwrap().parse_plain_attribute(name, value),
}
}
}