@@ -253,7 +253,7 @@ function pjax(options) {
253253
254254 // If $.pjax.defaults.version is a function, invoke it first.
255255 // Otherwise it can be a static string.
256- var currentVersion = ( typeof $ . pjax . defaults . version === 'function' ) ?
256+ var currentVersion = typeof $ . pjax . defaults . version === 'function' ?
257257 $ . pjax . defaults . version ( ) :
258258 $ . pjax . defaults . version
259259
@@ -299,7 +299,7 @@ function pjax(options) {
299299 if ( blurFocus ) {
300300 try {
301301 document . activeElement . blur ( )
302- } catch ( e ) { }
302+ } catch ( e ) { /* ignore */ }
303303 }
304304
305305 if ( container . title ) document . title = container . title
@@ -492,7 +492,7 @@ function onPjaxPopstate(event) {
492492
493493 // Force reflow/relayout before the browser tries to restore the
494494 // scroll position.
495- container [ 0 ] . offsetHeight
495+ container [ 0 ] . offsetHeight // eslint-disable-line no-unused-expressions
496496 } else {
497497 locationReplace ( location . href )
498498 }
@@ -566,7 +566,7 @@ function cloneContents(container) {
566566 // Unmark script tags as already being eval'd so they can get executed again
567567 // when restored from cache. HAXX: Uses jQuery internal method.
568568 cloned . find ( 'script' ) . each ( function ( ) {
569- if ( ! this . src ) jQuery . _data ( this , 'globalEval' , false )
569+ if ( ! this . src ) $ . _data ( this , 'globalEval' , false )
570570 } )
571571 return cloned . contents ( )
572572}
@@ -665,13 +665,14 @@ function extractContainer(data, xhr, options) {
665665 var serverUrl = xhr . getResponseHeader ( 'X-PJAX-URL' )
666666 obj . url = serverUrl ? stripInternalParams ( parseURL ( serverUrl ) ) : options . requestUrl
667667
668+ var $head , $body
668669 // Attempt to parse response html into elements
669670 if ( fullDocument ) {
670- var $body = $ ( parseHTML ( data . match ( / < b o d y [ ^ > ] * > ( [ \s \S . ] * ) < \/ b o d y > / i) [ 0 ] ) )
671+ $body = $ ( parseHTML ( data . match ( / < b o d y [ ^ > ] * > ( [ \s \S . ] * ) < \/ b o d y > / i) [ 0 ] ) )
671672 var head = data . match ( / < h e a d [ ^ > ] * > ( [ \s \S . ] * ) < \/ h e a d > / i)
672- var $head = head != null ? $ ( parseHTML ( head [ 0 ] ) ) : $body
673+ $head = head != null ? $ ( parseHTML ( head [ 0 ] ) ) : $body
673674 } else {
674- var $head = $body = $ ( parseHTML ( data ) )
675+ $head = $body = $ ( parseHTML ( data ) )
675676 }
676677
677678 // If response data is empty, return fast
@@ -683,12 +684,11 @@ function extractContainer(data, xhr, options) {
683684 obj . title = findAll ( $head , 'title' ) . last ( ) . text ( )
684685
685686 if ( options . fragment ) {
687+ var $fragment = $body
686688 // If they specified a fragment, look for it in the response
687689 // and pull it out.
688- if ( options . fragment === 'body' ) {
689- var $fragment = $body
690- } else {
691- var $fragment = findAll ( $body , options . fragment ) . first ( )
690+ if ( options . fragment !== 'body' ) {
691+ $fragment = findAll ( $fragment , options . fragment ) . first ( )
692692 }
693693
694694 if ( $fragment . length ) {
@@ -797,8 +797,8 @@ function cachePop(direction, id, value) {
797797 }
798798
799799 pushStack . push ( id )
800- if ( id = popStack . pop ( ) )
801- delete cacheMapping [ id ]
800+ id = popStack . pop ( )
801+ if ( id ) delete cacheMapping [ id ]
802802
803803 // Trim whichever stack we just pushed to to max cache length.
804804 trimCacheStack ( pushStack , pjax . defaults . maxCacheLength )
@@ -894,6 +894,10 @@ $.support.pjax =
894894 // pushState isn't reliable on iOS until 5.
895895 ! navigator . userAgent . match ( / ( ( i P o d | i P h o n e | i P a d ) .+ \b O S \s + [ 1 - 4 ] \D | W e b A p p s \/ .+ C F N e t w o r k ) / )
896896
897- $ . support . pjax ? enable ( ) : disable ( )
897+ if ( $ . support . pjax ) {
898+ enable ( )
899+ } else {
900+ disable ( )
901+ }
898902
899903} ) ( jQuery )
0 commit comments