Skip to content

Commit 9d10182

Browse files
committed
Move pushCache into XHR success handler.
1 parent 4a0df41 commit 9d10182

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

jquery.pjax.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,11 @@ function pjax(options) {
253253
return
254254
}
255255

256+
if (options.push && !options.replace) {
257+
// Cache current container element before replacing it
258+
cachePush(pjax.state.id, context.clone().contents())
259+
}
260+
256261
// Update browser location and history
257262
pjax.state = {
258263
id: options.id || uniqueId(),
@@ -344,11 +349,6 @@ function pjax(options) {
344349
var xhr = pjax.xhr = $.ajax(options)
345350

346351
if (xhr.readyState > 0) {
347-
if (options.push && !options.replace) {
348-
// Cache current container element before replacing it
349-
cachePush(pjax.state.id, context.clone().contents())
350-
}
351-
352352
fire('pjax:start', [xhr, options])
353353
fire('pjax:send', [xhr, options])
354354
}

0 commit comments

Comments
 (0)