diff --git a/image/private/kernel.js b/image/private/kernel.js index cce8d58..964f8d6 100644 --- a/image/private/kernel.js +++ b/image/private/kernel.js @@ -157,16 +157,18 @@ BaseImage.prototype.toDomNode = function(cache) { var height = that.getHeight(); var canvas = makeCanvas(width, height); + // KLUDGE: on IE, the canvas rendering functions depend on a // context where the canvas is attached to the DOM tree. // We initialize an afterAttach hook; the client's responsible // for calling this after the dom node is attached to the // document. - canvas.afterAttach = function() { - var ctx = canvas.getContext("2d"); - that.render(ctx, 0, 0); - }; + $(canvas).bind('afterAttach', + function(event) { + var ctx = canvas.getContext("2d"); + that.render(ctx, 0, 0); + }); return canvas; }; diff --git a/js-assembler/runtime-src/baselib-ports.js b/js-assembler/runtime-src/baselib-ports.js index b57c951..cbf98f4 100644 --- a/js-assembler/runtime-src/baselib-ports.js +++ b/js-assembler/runtime-src/baselib-ports.js @@ -16,6 +16,7 @@ StandardOutputPort.prototype = baselib.heir(OutputPort.prototype); StandardOutputPort.prototype.writeDomNode = function(MACHINE, domNode) { MACHINE.params['currentDisplayer'](MACHINE, domNode); + jQuery(domNode).trigger({type : 'afterAttach'}); }; var StandardErrorPort = function() { @@ -24,6 +25,7 @@ StandardErrorPort.prototype = baselib.heir(OutputPort.prototype); StandardErrorPort.prototype.writeDomNode = function(MACHINE, domNode) { MACHINE.params['currentErrorDisplayer'](MACHINE, domNode); + jQuery(domNode).trigger({type : 'afterAttach'}); };