Re-insertion of <script> tags

ⅰ亾dé卋堺 提交于 2019-12-14 02:06:47

问题


  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)


回答1:


Would simply evaling the code be sufficient for your purposes?

eval(script_element.innerText);

Update: Reappending the script seems to work.




回答2:


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.



来源:https://stackoverflow.com/questions/1704979/re-insertion-of-script-tags

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!