diff options
author | Matthew Rasmus <mattr@zzntd.com> | 2014-12-07 12:55:43 -0800 |
---|---|---|
committer | Matthew Rasmus <mattr@zzntd.com> | 2014-12-16 11:34:04 -0800 |
commit | a5c0bb708d03b1e878f419617fb016853d2200bb (patch) | |
tree | 0db6c5c19f3b72218bfc25244536dbbe9f2f7388 /components/script | |
parent | 4d0a6a6bd6f2aed259988969fab1f14c880c2257 (diff) | |
download | servo-a5c0bb708d03b1e878f419617fb016853d2200bb.tar.gz servo-a5c0bb708d03b1e878f419617fb016853d2200bb.zip |
htmltextarea: Fixed some value_changed issues
Also modified tests/html/textarea.html to allow for the testing of the
textarea's dirty value flag.
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/htmltextareaelement.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs index a22279a3deb..431be82e9db 100644 --- a/components/script/dom/htmltextareaelement.rs +++ b/components/script/dom/htmltextareaelement.rs @@ -148,7 +148,7 @@ impl<'a> HTMLTextAreaElementMethods for JSRef<'a, HTMLTextAreaElement> { // if the element's dirty value flag is false, then the element's // raw value must be set to the value of the element's textContent IDL attribute if !self.value_changed.get() { - self.SetValue(node.GetTextContent().unwrap()); + self.reset(); } } @@ -159,7 +159,9 @@ impl<'a> HTMLTextAreaElementMethods for JSRef<'a, HTMLTextAreaElement> { // https://html.spec.whatwg.org/multipage/forms.html#dom-textarea-value fn SetValue(self, value: DOMString) { + // TODO move the cursor to the end of the field self.textinput.borrow_mut().set_content(value); + self.value_changed.set(true); self.force_relayout(); } } @@ -255,7 +257,7 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLTextAreaElement> { _ => (), } - if child.is_text() { + if child.is_text() && !self.value_changed.get() { self.reset(); } } |