test case isn't passing. Trying to find out why.

This commit is contained in:
Danny Yoo 2011-09-08 15:35:20 -04:00
parent 1618b3d180
commit 9428b69d44
3 changed files with 50 additions and 7 deletions

View File

@ -44,3 +44,10 @@ false
(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"
"id"
"para"
"remove"
(html (head) (body "some text"))
"some text"

View File

@ -220,3 +220,32 @@
"my-field")
"value"
"hello again"))
(newline)
"id"
(view-id
(view-focus (->view (xexp->dom '(html (head) (body (p (@ (id "para")))))))
"para"))
(newline)
"remove"
(view->xexp
(view-remove
(view-focus (->view
(xexp->dom '(html (head)
(body (input (@ (id "my-field")
(type "text")
(value "this is a message")))
"some text"))))
"my-field")))
(view-text
(view-remove
(view-focus (->view
(xexp->dom '(html (head)
(body (input (@ (id "my-field")
(type "text")
(value "this is a message")))
"some text"))))
"my-field")))

View File

@ -1354,21 +1354,28 @@
return false;
};
var firstLessThan = function(x, y) {
return x[0] < y[0];
};
var domToXexp = function(dom) {
var child, attrs, name, convertedChildren, i;
var child, attrs, name, convertedChildren, i, attributes;
if (dom.nodeType === 1) {
attributes = [];
attrs = plt.baselib.lists.EMPTY;
name = plt.baselib.symbols.makeSymbol(dom.nodeName.toLowerCase());
child = dom.firstChild;
convertedChildren = plt.baselib.lists.EMPTY;
for (i = 0; i < dom.attributes.length; i++) {
attrs = plt.baselib.lists.makePair(
plt.baselib.lists.makeList(plt.baselib.symbols.makeSymbol(dom.attributes[i].nodeName),
dom.attributes[i].nodeValue),
attrs);
attrs = plt.baselib.lists.reverse(attrs);
attributes.push([dom.attributes[i].nodeName, dom.attributes[i].nodeValue]);
}
attributes.sort(firstLessThan);
for (i = 0; i < attributes.length; i++) {
attrs = plt.baselib.lists.makePair(
plt.baselib.lists.makeList(plt.baselib.symbols.makeSymbol(attributes[i][0]),
attributes[i][1]),
attrs);
}
while(child !== null) {
if (child.nodeType === 1) {
convertedChildren =