File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change 11function handleExternalScript ( ) {
22 const container = Docsify . dom . getNode ( '#main' )
3- const script = Docsify . dom . find ( container , 'script' )
3+ const scripts = Docsify . dom . findAll ( container , 'script' )
44
5- if ( script && script . src ) {
6- const newScript = document . createElement ( 'script' )
5+ for ( let i = scripts . length ; i -- ; ) {
6+ const script = scripts [ i ]
77
8- ; [ 'src' , 'async' , 'defer' ] . forEach ( attribute => {
9- newScript [ attribute ] = script [ attribute ]
10- } )
8+ if ( script && script . src ) {
9+ const newScript = document . createElement ( 'script' )
1110
12- script . parentNode . insertBefore ( newScript , script )
13- script . parentNode . removeChild ( script )
11+ ; [ 'src' , 'async' , 'defer' ] . forEach ( attribute => {
12+ newScript [ attribute ] = script [ attribute ]
13+ } )
14+
15+ script . parentNode . insertBefore ( newScript , script )
16+ script . parentNode . removeChild ( script )
17+ }
1418 }
1519}
1620
You can’t perform that action at this time.
0 commit comments