fixing bind on anonymous values.
This commit is contained in:
parent
c00a64d078
commit
5d24ac1af7
|
@ -23,7 +23,7 @@
|
|||
;; until we're all done.
|
||||
(define (draw w v)
|
||||
(cond [(< w (length dwarf-names))
|
||||
(view-append-child (view-focus v "ul")
|
||||
(view-append-child (view-focus v "#list")
|
||||
(make-item (list-ref dwarf-names w)))]
|
||||
[else
|
||||
v]))
|
||||
|
@ -36,5 +36,5 @@
|
|||
|
||||
(big-bang 0
|
||||
(initial-view index.html)
|
||||
(on-tick tick 1)
|
||||
(on-tick tick 10)
|
||||
(to-draw draw))
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<html>
|
||||
<head><title>Dwarves</title></head>
|
||||
<body>
|
||||
<ul id="#list"></ul>
|
||||
<h1>Dwarfs from Snow White</h1>
|
||||
<ul id="list">
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -261,9 +261,8 @@
|
|||
|
||||
// HACK: every node that is bound needs to have an id. We
|
||||
// enforce this by mutating the node.
|
||||
if ($(this.cursor.node).attr("id") === undefined) {
|
||||
$(this.cursor.node).attr("id",
|
||||
("__webWorldId_" + mockViewIdGensym++));
|
||||
if (this.cursor.node.id === undefined) {
|
||||
this.cursor.node.id = ("__webWorldId_" + mockViewIdGensym++);
|
||||
}
|
||||
|
||||
return this.act(
|
||||
|
@ -330,9 +329,9 @@
|
|||
while (cursor.canRight()) {
|
||||
cursor = cursor.right();
|
||||
}
|
||||
return cursor.insertRight(domNode);
|
||||
return cursor.insertRight(domNode.cloneNode(true));
|
||||
} else {
|
||||
return cursor.insertDown(domNode);
|
||||
return cursor.insertDown(domNode.cloneNode(true));
|
||||
}
|
||||
},
|
||||
function(eventHandlers) { return eventHandlers; },
|
||||
|
@ -481,12 +480,12 @@
|
|||
} catch (exn) {
|
||||
return onFail(exn);
|
||||
}
|
||||
return onSuccess(dom);
|
||||
return onSuccess(dom.get(0));
|
||||
} else if (isMockView(x)) {
|
||||
return onSuccess(x.cursor.top().node);
|
||||
} else {
|
||||
try {
|
||||
dom = $(plt.baselib.format.toDomNode(x))
|
||||
dom = plt.baselib.format.toDomNode(x);
|
||||
} catch (exn) {
|
||||
return onFail(exn);
|
||||
}
|
||||
|
@ -496,8 +495,8 @@
|
|||
|
||||
|
||||
var isDomNode = function(x) {
|
||||
if (return x.hasOwnProperty(nodeType) &&
|
||||
x.nodeType === 1);
|
||||
return (x.hasOwnProperty('nodeType') &&
|
||||
x.nodeType === 1);
|
||||
};
|
||||
|
||||
|
||||
|
@ -1225,13 +1224,33 @@
|
|||
|
||||
|
||||
|
||||
EXPORTS['view-append-child'] = makePrimitiveProcedure(
|
||||
EXPORTS['view-append-child'] = makeClosure(
|
||||
'view-append-child',
|
||||
2,
|
||||
function(MACHINE) {
|
||||
var view = checkMockView(MACHINE, 'view-append-child', 1);
|
||||
var dom = coerseToDomNode(MACHINE.env[MACHINE.env.length - 2]);
|
||||
return view.appendChild(dom);
|
||||
var view = checkMockView(MACHINE, 'view-append-child', 0);
|
||||
var oldArgcount = MACHINE.argcount;
|
||||
var x = MACHINE.env[MACHINE.env.length - 2];
|
||||
PAUSE(function(restart) {
|
||||
coerseToDomNode(x,
|
||||
function(dom) {
|
||||
restart(function(MACHINE) {
|
||||
MACHINE.argcount = oldArgcount;
|
||||
var updatedView = view.appendChild(dom);
|
||||
finalizeClosureCall(MACHINE, updatedView);
|
||||
});
|
||||
},
|
||||
function(err) {
|
||||
restart(function(MACHINE) {
|
||||
plt.baselib.exceptions.raise(
|
||||
MACHINE,
|
||||
new Error(plt.baselib.format.format(
|
||||
"unable to translate ~s to dom node: ~a",
|
||||
[x, exn.message])));
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user