The mechanical side of this is dead simple: the web page will compile
and run any code you feed it, end of story.
So if you put in
function foo() { return "foo"; }
and later
function foo() { return "bar"; }
then
foo();
will give you 'bar';
On the other hand its dead simple: if you run some code that does:
delete window.foo;
then later you try to compile:
foo.bar = "baz";
it will fail. No matter that the compile would have worked had you
reloaded the page. The technical version of "dead simple" is there is
no dependency analysis.
The usability part of the story is more complex.
In my opinion the sweet spot is function-level recompile, where you
can edit line by line and be directly integrated editing with the
browser. I think that is hard to do without some small work on the
browser, because you need to change the function object so that all
pointers to the object are still correct. I'm planning to work on
this later this year.
File level or top-level block recompile is practical from the
mechanical point of view, but its hard to see how the user experience
is better than reloading the page. The time won't be much faster and
the uncertainty of the result will negate part of its value. I'd be
happy to be wrong however.
jjb
On Feb 24, 1:19 pm, alex <[email protected]> wrote:
> have these questions been answered yet from the "edit javascript on
> the fly" question.
>
> Raku asked this
>
> 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?
>
> On Feb 23, 5:02 pm, Brian Di Palma <[email protected]> wrote:
>
> > I suggest you also try and change your development method to develop locally
> > on your machine and test it there instead of going to the pain of working on
> > an FTP server and - or at least try a tool like Aptana to deal with the FTP.
>
> > On Mon, Feb 23, 2009 at 8:16 PM, alex <[email protected]> wrote:
>
> > > thank you so much this will really help. i think the file already
> > > loads when i visit my page so commenting them out may not work. but im
> > > going to try putting in different javascript farther down the page
> > > maybe outside the header to see if that will override the linked
> > > javascript, thats in the header file of the page.
>
> > > On Feb 23, 12:11 pm, John J Barton <[email protected]>
> > > wrote:
> > > > Javascript is compiled in the order it appears and then the top level
> > > > code runs. That's it.
>
> > > > So if inline comes first, its first; if included file comes first it
> > > > is first.
>
> > > > By 'order' I mean in time, not space. So if you add a script tag
> > > > inline or not later, that code overrides any definitions that match
> > > > from earlier code.
>
> > > > If you don't want js files in the header from loading, comment them
> > > > out.
>
> > > > jjb
>
> > > > On Feb 23, 8:53 am, alex <[email protected]> wrote:
>
> > > > > this may seem confusing and i will be willing to clarify but this is
> > > > > my question.
>
> > > > > I want to try debugging javascript on one of my webpages and compare
> > > > > it to another page that i am trying to get some inspiration from. I
> > > > > would like to debug the javascript in my browser instead of having to
> > > > > continuously go through ftp and overwrite files.
>
> > > > > so i want to edit javascript in a page, i already know how do to this
> > > > > with javascript embedded in the html as this is easy you just click on
> > > > > it.
>
> > > > > but what about editing external javascript files? and how they
> > > > > interact with the page
>
> > > > > if there are linked external javascript files in a page, and then
> > > > > there is javascript code embedded in the actual page. does one take
> > > > > presedence over the other or is an error created?
>
> > > > > can you override the linked javascript somehow, maybe by changing the
> > > > > links to a different page? because it loads when the page loads even
> > > > > if you changed the urls to reference different .js files how would you
> > > > > get the page to read the external files with the new link.
>
> > > > > is there a way to keep linked .js files in the header from loading?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Firebug" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/firebug?hl=en
-~----------~----~----~----~------~----~------~--~---