Implements HTMLInputElement.defaultValue

...and changes SetValue to update the input text instead of the content
attr.

Also includes a comment summarizing everything I currently know with
respect to an input elements checkedness vs its IDL attributes vs its
content attributes.
This commit is contained in:
Matthew Rasmus 2014-11-27 15:22:02 -08:00
parent f686943eb4
commit f932a6947a
2 changed files with 11 additions and 2 deletions

View file

@ -223,7 +223,16 @@ impl<'a> HTMLInputElementMethods for JSRef<'a, HTMLInputElement> {
}
// https://html.spec.whatwg.org/multipage/forms.html#dom-input-value
make_setter!(SetValue, "value")
fn SetValue(self, value: DOMString) {
self.textinput.borrow_mut().set_content(value);
self.force_relayout();
}
// https://html.spec.whatwg.org/multipage/forms.html#dom-input-defaultvalue
make_getter!(DefaultValue, "value")
// https://html.spec.whatwg.org/multipage/forms.html#dom-input-defaultvalue
make_setter!(SetDefaultValue, "value")
// https://html.spec.whatwg.org/multipage/forms.html#attr-fe-name
make_getter!(Name)

View file

@ -38,7 +38,7 @@ interface HTMLInputElement : HTMLElement {
// attribute DOMString src;
// attribute DOMString step;
attribute DOMString type;
// attribute DOMString defaultValue;
attribute DOMString defaultValue;
[TreatNullAs=EmptyString] attribute DOMString value;
// attribute Date? valueAsDate;
// attribute unrestricted double valueAsNumber;