fixed bug with insert-right that was causing broken invariant

This commit is contained in:
Danny Yoo 2011-09-08 14:48:08 -04:00
parent e30a1d0be1
commit 6b78d5154f
3 changed files with 20 additions and 18 deletions

View File

@ -131,30 +131,34 @@
(view->xexp
(view-insert-right
(view-down (view-focus (->view (xexp->dom '(html (head)
(body (h1 (@ (id "header")))
(p (@ (id "para"))
(ul (li "one")))))))
"para"))
(view-down
(view-down
(view-focus (->view (xexp->dom '(html (head)
(body (h1 (@ (id "header")))
(p (@ (id "para"))
(ul (li "one")))))))
"para")))
(xexp->dom '(li "two"))))
(view->xexp
(view-insert-right
(view-insert-right
(view-down (view-focus (->view (xexp->dom '(html (head)
(body (h1 (@ (id "header")))
(p (@ (id "para"))
(ul (li "one")))))))
"para"))
(view-down
(view-down (view-focus (->view (xexp->dom '(html (head)
(body (h1 (@ (id "header")))
(p (@ (id "para"))
(ul (li "one")))))))
"para")))
(xexp->dom '(li "two")))
(xexp->dom '(li "three"))))
(view->xexp
(view-insert-left
(view-down (view-focus (->view (xexp->dom '(html (head)
(body (h1 (@ (id "header")))
(p (@ (id "para"))
(ul (li "one")))))))
"para"))
(view-down
(view-down (view-focus (->view (xexp->dom '(html (head)
(body (h1 (@ (id "header")))
(p (@ (id "para"))
(ul (li "one")))))))
"para")))
(xexp->dom '(li "zero"))))

View File

@ -235,8 +235,6 @@
MockView.prototype.updateCss = function(name, value) {
return this.act(
function(cursor) {
console.log($(cursor.node[0].cloneNode(false))
.css(name, value).get(0));
return cursor.replaceNode([$(cursor.node[0].cloneNode(false))
.css(name, value).get(0)]
.concat(cursor.node.slice(1)));

View File

@ -171,7 +171,7 @@ var TreeCursor = (function() {
TreeCursor.prototype.insertRight = function(n) {
return new TreeCursor(this.parent,
n,
this.prevs.concat(this.node),
this.prevs.concat([this.node]),
this.nexts,
this.openF,
this.closeF,