Skip to content

Commit 4d3e868

Browse files
committed
Merge pull request #266 from drock/patch-1
Fix fragment inclusion when fragment === 'body'
2 parents 3a32250 + 4a20856 commit 4d3e868

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

jquery.pjax.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ function extractContainer(data, xhr, options) {
684684
}
685685

686686
if ($fragment.length) {
687-
obj.contents = $fragment.contents()
687+
obj.contents = options.fragment === 'body' ? $fragment : $fragment.contents()
688688

689689
// If there's no title, look for data-title and title attributes
690690
// on the fragment

test/unit/pjax.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ if ($.support.pjax) {
314314

315315
frame.$('body').on('pjax:success', function(event, data) {
316316
equal(typeof data, 'string')
317-
equal(frame.$("body > p").html().trim(), "Hello!")
317+
equal(frame.$("body > #main > p").html().trim(), "Hello!")
318318
equal(frame.document.title, "Hello")
319319
start()
320320
})

0 commit comments

Comments
 (0)