views:

73

answers:

2
  1. Insertion of a file's tag, thus executing the file's code.
  2. Removal of the file's tag.
  3. Insertion of the same file's tag.

Firebug does not seem to acknowledge and does not show the reinserted tag when the file's has already been inserted before. It does upon new insertions, of course.

EDIT: Is this a problem of some kind? (the file still reloads apparently, but my tests only rely on logging some simple stuff)

+3  A: 

Would simply evaling the code be sufficient for your purposes?

eval(script_element.innerText);

Update: Reappending the script seems to work.

BipedalShark
I rather not rely on eval (which will be deprecated on ECMA5) for something like this, even if it works. Thanks for the idea though :)
leomdg
OK. And appending the script element to the head element doesn't work as a reinsertion?
BipedalShark
See update for another method.
BipedalShark
Yes, if you reinsert the same file's <script> tag, the code gets rerun. Even if you remove it before reinserting it, the code gets rerun, and that was resolved here: http://stackoverflow.com/questions/1704876/re-executing-javascript-files ... BUT, and this is why @Pekka Gaiser might have found this two questions to be the same although they are not: this question is about FireBug not showing it back after removing it (that's the key step) and if that brings or not any side-effects (maybe it means the code is rerun but not entirely or something, I don't know).
leomdg
Looking at Firebug's HTML DOM tree, it appears to acknowledge that the script was reinserted. The script is also (re)listed in Firebug's scripts section.
BipedalShark
Really? Not for me. Weird. Could me using LAB ( http://labjs.com/ ) have something to do with this?
leomdg
Using LAB for loading, the removal is done through plain JavaScript
leomdg
I dot not know how LAB loads. That seems a likely source of your problem, though.
BipedalShark
Well, I don't intend to loose LAB. Plus the code reruns and I don't see problems, so I will let FireBug get away with this one but I will keep this in mind if I see something similar going on. I will undelete my answer to my question to resolve this. Thank you.
leomdg
A: 

Apparently, FireBug not showing the reinserted tag after removing it (probably LAB's fault) does not bring any side effects or problems which could need any atenttion.

Even the code gets rerun, so I guess problem solved.

leomdg