One of the programmers I worked with has something similar in code:
var head = document.getElementsByTagName("head")[0];
var e = document.createElement("script");
e.type = "text/javascript";
var b = "function moo() { alert('hello'); }";
e.appendChild(document.createTextNode(b));
head.appendChild(e);
moo();
This is all good and dandy, but I would like to step into moo(), and firebug just can't do that. I know I can rip the whole thing apart, but I reallllly don't want to touch it and his code works :)
Any ideas how I can debug this with Firebug?
Cheers
evalthere (in a general sense), and there's nearly always a better way to approach it.new Function("...")or eval it?eval. If he's going to refactor it, I'd push for avoiding theeval-like-ness entirely. :-)evalornew Function().