@@ -122,11 +122,10 @@ add('message', ({ data: { options, config: baseURL, configURL, code, hooks } })
122
122
123
123
// there's no way to query the DOM, use foreign CustomEvent and so on
124
124
// in case there's no SharedArrayBuffer around.
125
- let CustomEvent , document , notify , currentScript = null , target = '' ;
125
+ let notify , currentScript = null , target = '' ;
126
126
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 ) ;
130
129
}
131
130
132
131
// TODO: even this is problematic without SharedArrayBuffer
@@ -143,7 +142,7 @@ add('message', ({ data: { options, config: baseURL, configURL, code, hooks } })
143
142
if ( ! target && currentScript ) {
144
143
if ( tag === 'SCRIPT' ) {
145
144
currentScript . after ( assign (
146
- document . createElement ( `script-${ custom || type } ` ) ,
145
+ window . document . createElement ( `script-${ custom || type } ` ) ,
147
146
{ id : ( target = `${ id } -target` ) }
148
147
) ) ;
149
148
}
0 commit comments