Skip to content

Commit a5b319f

Browse files
committed
Fix fragment inclusion when fragment === 'body'
In the case where 'body' was specified as the fragment the $fragment variable already pointed to the list of child nodes for the body so calling .contents() gave back the second level of descendents instead of the desired first level.
1 parent 980f635 commit a5b319f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

jquery.pjax.js

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

632632
if ($fragment.length) {
633-
obj.contents = $fragment.contents()
633+
obj.contents = options.fragment === 'body' ? $fragment : $fragment.contents()
634634

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

0 commit comments

Comments
 (0)