@@ -122,11 +122,10 @@ add('message', ({ data: { options, config: baseURL, configURL, code, hooks } })
122122
123123 // there's no way to query the DOM, use foreign CustomEvent and so on
124124 // in case there's no SharedArrayBuffer around.
125- let CustomEvent , document , notify , currentScript = null , target = '' ;
125+ let notify , currentScript = null , target = '' ;
126126 if ( syncMainAndWorker ) {
127- ( { CustomEvent, document } = window ) ;
128- currentScript = id && document . getElementById ( id ) || null ;
129- notify = kind => dispatch ( currentScript , custom || type , kind , true , CustomEvent ) ;
127+ currentScript = id && window . document . getElementById ( id ) || null ;
128+ notify = kind => dispatch ( currentScript , custom || type , kind , true , window . CustomEvent ) ;
130129 }
131130
132131 // TODO: even this is problematic without SharedArrayBuffer
@@ -143,7 +142,7 @@ add('message', ({ data: { options, config: baseURL, configURL, code, hooks } })
143142 if ( ! target && currentScript ) {
144143 if ( tag === 'SCRIPT' ) {
145144 currentScript . after ( assign (
146- document . createElement ( `script-${ custom || type } ` ) ,
145+ window . document . createElement ( `script-${ custom || type } ` ) ,
147146 { id : ( target = `${ id } -target` ) }
148147 ) ) ;
149148 }
0 commit comments