@@ -70,7 +70,7 @@ function courier(tabId, changed) {
7070// because `detail` in the dispatched custom events is `null` 
7171const  script  =  document . createElement ( 'script' ) ; 
7272script . setAttribute ( 'src' ,  source ) ; 
73- document . documentElement . appendChild ( script ) ; 
73+ document . head . appendChild ( script ) ; 
7474
7575// // TODO: reenable profiler 
7676// if (message.type === 'bridge::ext/profiler' && message.payload) { 
@@ -108,7 +108,7 @@ function courier(tabId, changed) {
108108
109109chrome . tabs . onActivated . addListener ( ( {  tabId } )  =>  sensor ( tabId ) ) ; 
110110chrome . tabs . onUpdated . addListener ( 
111- ( tabId ,  changed )  =>  changed . status  ===  'loading '  &&  sensor ( tabId ) , 
111+ ( tabId ,  changed )  =>  changed . status  ===  'unloaded '  &&  sensor ( tabId ) , 
112112) ; 
113113
114114/** @param  {number } tabId */ 
@@ -122,7 +122,7 @@ async function sensor(tabId) {
122122document . querySelector ( `script[src="${ source }  "]` ) ?. remove ( ) ; 
123123const  script  =  document . createElement ( 'script' ) ; 
124124script . setAttribute ( 'src' ,  source ) ; 
125- document . documentElement . appendChild ( script ) ; 
125+ document . head . appendChild ( script ) ; 
126126
127127document . addEventListener ( 'SvelteDevTools' ,  ( {  detail } )  =>  { 
128128chrome . runtime . sendMessage ( detail ) ; 
0 commit comments