avoid reExecute GM_BrowserUI.contentLoad(event);

9 views
Skip to first unread message

Scimmia

unread,
May 8, 2012, 12:01:56 PM5/8/12
to greasemon...@googlegroups.com
I have my addon.
i have event in DOMContentLoaded that modify html body:
event.originalTarget.documentElement.getElementsByTagName('body')[0].innerHTML = res.body;
but after i modify "addEventListener" in GM are lost.
Then i must add line:
GM_BrowserUI.contentLoad(event);
do it have other best solution?
excuse my poor English.

Anthony Lieuallen

unread,
May 8, 2012, 1:35:40 PM5/8/12
to greasemon...@googlegroups.com
On Tue, May 8, 2012 at 12:01 PM, Scimmia <diama...@gmail.com> wrote:
but after i modify "addEventListener" in GM are lost.

That's what happens when you assign to innerHTML -- it destroys all the overwritten nodes (and their event handlers) and replaces them with brand new ones.  Don't do that.
Reply all
Reply to author
Forward
0 new messages