Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't find container.contents with "most common use of pjax" rise reload page any time #702

Open
bscheshirwork opened this issue Jul 26, 2018 · 0 comments

Comments

@bscheshirwork
Copy link

The simplest and most common use of pjax looks like this:

$(document).pjax('a', '#pjax-container')

so... the option.fragment not definite =>

jquery-pjax/jquery.pjax.js

Lines 686 to 705 in 153262e

if (options.fragment) {
var $fragment = $body
// If they specified a fragment, look for it in the response
// and pull it out.
if (options.fragment !== 'body') {
$fragment = findAll($fragment, options.fragment).first()
}
if ($fragment.length) {
obj.contents = options.fragment === 'body' ? $fragment : $fragment.contents()
// If there's no title, look for data-title and title attributes
// on the fragment
if (!obj.title)
obj.title = $fragment.attr('title') || $fragment.data('title')
}
} else if (!fullDocument) {
obj.contents = $body
}

in fullDocument case the obj.contents not set

jquery-pjax/jquery.pjax.js

Lines 276 to 280 in 153262e

// If the new response is missing a body, hard load the page
if (!container.contents) {
locationReplace(container.url)
return
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant