From a39fb910ce399358103afe19a544bbe562d6d74d Mon Sep 17 00:00:00 2001 From: Danny Yoo Date: Mon, 12 Sep 2011 13:37:40 -0400 Subject: [PATCH] still chasing the discrepency between the imperative edits and the functional ones --- .../examples/forward-backward/forward-backward.rkt | 2 +- web-world/js-impl.js | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/web-world/examples/forward-backward/forward-backward.rkt b/web-world/examples/forward-backward/forward-backward.rkt index c1fbc927..986b622b 100644 --- a/web-world/examples/forward-backward/forward-backward.rkt +++ b/web-world/examples/forward-backward/forward-backward.rkt @@ -19,7 +19,7 @@ (define (clear-all a-view) (define (loop a-view n) - (define updated-view (update-view-css a-view "border" "none")) + (define updated-view a-view) ;; (update-view-css a-view "border" "none")) (cond [(view-forward? updated-view) (loop (view-forward updated-view) (add1 n))] diff --git a/web-world/js-impl.js b/web-world/js-impl.js index d6aac71c..08e785ae 100644 --- a/web-world/js-impl.js +++ b/web-world/js-impl.js @@ -235,6 +235,8 @@ MockView.prototype.updateCss = function(name, value) { return this.act( function(cursor) { + console.log("functionally: ", + $(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))); @@ -243,6 +245,10 @@ return eventHandlers; }, function(view) { + if (view.focus.length === 0) { + console.log('update css: empty focus?!'); + } + console.log('css: updating:\n', view.focus); view.focus.css(name, value); }); }; @@ -525,8 +531,6 @@ return this.cursor.node[0].id; }; - - MockView.prototype.isUpMovementOk = function() { return this.cursor.canUp(); }; @@ -1226,6 +1230,7 @@ // update, and have to do it from scratch. var nonce = Math.random(); var originalMockView = view.getMockAndResetFocus(nonce); + console.log("before: ", arrayTreeToDomNode(originalMockView.cursor.node)); toDraw(MACHINE, world, originalMockView, @@ -1233,6 +1238,9 @@ if (newMockView.nonce === nonce) { var i; var actions = newMockView.getPendingActions(); + console.log("this should match:", + view.focus.clone(true).get(0)); + console.log("actions", actions.length); for (i = 0; i < actions.length; i++) { actions[i](view); }