From f932a6947a0c5df0ab82bbeebf0a289ab2fc1ae8 Mon Sep 17 00:00:00 2001 From: Matthew Rasmus Date: Thu, 27 Nov 2014 15:22:02 -0800 Subject: [PATCH] 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. --- components/script/dom/htmlinputelement.rs | 11 ++++++++++- components/script/dom/webidls/HTMLInputElement.webidl | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index 5b0133395a7..12d6e11a639 100644 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -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) diff --git a/components/script/dom/webidls/HTMLInputElement.webidl b/components/script/dom/webidls/HTMLInputElement.webidl index 434da309f21..532ac73e25a 100644 --- a/components/script/dom/webidls/HTMLInputElement.webidl +++ b/components/script/dom/webidls/HTMLInputElement.webidl @@ -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;