Edit Javascript files on the fly

267 views
Skip to first unread message

laredo...@gmail.com

unread,
Jul 15, 2008, 7:36:40 PM7/15/08
to Firebug
Hi,

I'm using Firebug on WinXP. This is a pretty random request, but
Firebug is an amazing tool. Is it possible to edit the Javascript on
my pages (or in JS files) after the page has loaded and then re-run my
page?

Thanks, - Dave

splintor

unread,
Jul 16, 2008, 4:11:11 PM7/16/08
to Firebug
Hi Dave,
You currently can't do it in FireBug, but it might be nice to give a
more detailed example of what you are trying to do, as there might be
some other workarounds.

For instance, what do you mean by "re-run the page"? You can update
your JS files on the server and reload the page - this will do what
you want without help from Firebug.
If you only want to update one function in the page and see how it
affects the page, you might put the changed function code in the
Console's command line and execute it, and it might help:
function showResults() { alert('testing...'); }

Now calling the showResults function will execute this code. This
might not work if the page uses references to the old function (e.g.
even handlers). In this case, you''ll have to be more clever and try
to change the reference to reference ot the new function.

Regards,
splintor

On Jul 16, 2:36 am, "laredotorn...@zipmail.com"

Rako

unread,
Jul 17, 2008, 1:37:34 AM7/17/08
to Firebug
It would be nice to have a feature to modify the Javascript.
There are a number of ways one can rerun the code:
1.) the error is in an event-triggered function:
Modify the code and trigger the event (e.g. click on the button
again)
2.) In the initialising routine:
Include a call for the initialising routine in an event-triggered
function, trigger the event

Of course it may not work always, but in most cases it would do.

The main question is: how far can you modify the code:
a.) can you insert new code or just modify the existing one?
b.) can you comment out statements?
c.) what may be changed in an existing statement?
just parameters (like index, variable-name, property) or anything.
It all depends on the logic of the Javascript-interpreter/compiler and
if the code is precompiled before execution, can Firebug request a
recompilation after a code change?

These are a few thoughts on the subject, as I would love to have such
a feature.
> > Thanks, - Dave- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages