I think the plugin idea might well work. I assume that you would also pass to the caller the embedded JS content.
I admit it’s not trivial, but I think that most code used to generate graphics within a canvas (or all the stuff I would be interested in at least) wouldn’t actually interact with the browsers DOM – it would be calling getContext and then writing directly to that using JS so wouldn’t require DOM access.
This mechanism wouldn’t be fool-proof but I think it would be possible to create some “rules” for a JS author that make it easier to parse e.g. Perhaps the
when do you think you might have a version available with the plugin?