File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -246,17 +246,18 @@ function pjax(options) {
246
246
if ( container . title ) document . title = container . title
247
247
context . html ( container . contents )
248
248
249
- container . scripts . each ( function ( _ , script ) {
250
- var $script = $ ( script )
251
- var src = $script . attr ( 'src' )
252
- var target = document . head || context . get ( 0 )
253
- var tag = document . createElement ( 'script' )
254
- tag . type = $script . attr ( 'type' ) || "text/javascript"
255
- tag . async = false
256
- tag . src = src
257
- if ( ! $ ( 'script[src="' + src + '"]' ) . length )
258
- target . appendChild ( tag )
259
- } )
249
+ container . scripts . each ( function ( _ , script ) {
250
+ var $script = $ ( script )
251
+ var src = $script . attr ( 'src' )
252
+ if ( $ ( 'script[src="' + src + '"]' ) . length ) return
253
+
254
+ var target = document . head || context . get ( 0 )
255
+ var tag = document . createElement ( 'script' )
256
+ tag . type = $script . attr ( 'type' ) || "text/javascript"
257
+ tag . async = false
258
+ tag . src = src
259
+ target . appendChild ( tag )
260
+ } )
260
261
261
262
// Scroll to top by default
262
263
if ( typeof options . scrollTo === 'number' )
You can’t perform that action at this time.
0 commit comments