Skip to content

Commit c68cf82

Browse files
committed
Allow to change context in a pjax:beforeReplace handler
1 parent cc0dd17 commit c68cf82

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: jquery.pjax.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -281,14 +281,14 @@ function pjax(options) {
281281
state: pjax.state,
282282
previousState: previousState
283283
})
284-
context.html(container.contents)
284+
options.context.html(container.contents)
285285

286286
// FF bug: Won't autofocus fields that are inserted via JS.
287287
// This behavior is incorrect. So if theres no current focus, autofocus
288288
// the last field.
289289
//
290290
// http://www.w3.org/html/wg/drafts/html/master/forms.html
291-
var autofocusEl = context.find('input[autofocus], textarea[autofocus]').last()[0]
291+
var autofocusEl = options.context.find('input[autofocus], textarea[autofocus]').last()[0]
292292
if (autofocusEl && document.activeElement !== autofocusEl) {
293293
autofocusEl.focus();
294294
}

0 commit comments

Comments
 (0)