diff --git a/tests/more-tests/view.expected b/tests/more-tests/view.expected index 40cc5b4..14a1ea5 100644 --- a/tests/more-tests/view.expected +++ b/tests/more-tests/view.expected @@ -37,4 +37,10 @@ false (html (head) (body (h1 (@ (id "header"))) (p (@ (id "para")) (li "An item")))) (html (head) (body (h1 (@ (id "header"))) (p (@ (id "para")) (ul (li "one") (li "two"))))) (html (head) (body (h1 (@ (id "header"))) (p (@ (id "para")) (ul (li "one") (li "two") (li "three"))))) -(html (head) (body (h1 (@ (id "header"))) (p (@ (id "para")) (ul (li "zero") (li "one"))))) \ No newline at end of file +(html (head) (body (h1 (@ (id "header"))) (p (@ (id "para")) (ul (li "zero") (li "one"))))) + +"this is a message" +"hello again" +(html (head) (body (input (@ (id "my-field") (type "text") (value "this is a message"))))) +(html (head) (body (input (@ (id "my-field") (type "text") (value "hello again"))))) +"hello again" diff --git a/tests/more-tests/view.rkt b/tests/more-tests/view.rkt index e8aad99..306a422 100644 --- a/tests/more-tests/view.rkt +++ b/tests/more-tests/view.rkt @@ -162,3 +162,61 @@ (ul (li "one"))))))) "para"))) (xexp->dom '(li "zero")))) + + +(newline) + +(view-form-value + (view-focus (->view + (xexp->dom '(html (head) + (body (input (@ (id "my-field") + (type "text") + (value "this is a message"))))))) + "my-field")) + +(view-form-value + (update-view-form-value + (view-focus (->view + (xexp->dom '(html (head) + (body (input (@ (id "my-field") + (type "text") + (value "this is a message"))))))) + "my-field") + "hello again")) + + +;; For some reason, updating the form value doesn't touch the attribute, so the +;; xexp stays the same. +(view->xexp + (update-view-form-value + (view-focus (->view + (xexp->dom '(html (head) + (body (input (@ (id "my-field") + (type "text") + (value "this is a message"))))))) + "my-field") + "hello again")) + +;; When you change the attribute, it also changes the form value... +;; Good grief, sometimes I dislike the DOM... +(view->xexp + (update-view-attr + (view-focus (->view + (xexp->dom '(html (head) + (body (input (@ (id "my-field") + (type "text") + (value "this is a message"))))))) + "my-field") + "value" + "hello again")) + +(view-form-value + (update-view-attr + (view-focus (->view + (xexp->dom '(html (head) + (body (input (@ (id "my-field") + (type "text") + (value "this is a message"))))))) + "my-field") + "value" + "hello again")) diff --git a/web-world/js-impl.js b/web-world/js-impl.js index 64a41de..187986a 100644 --- a/web-world/js-impl.js +++ b/web-world/js-impl.js @@ -1367,6 +1367,7 @@ plt.baselib.lists.makeList(plt.baselib.symbols.makeSymbol(dom.attributes[i].nodeName), dom.attributes[i].nodeValue), attrs); + attrs = plt.baselib.lists.reverse(attrs); } while(child !== null) { if (child.nodeType === 1) {