Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -585,11 +585,14 @@ jQuery.noConflict(); | |
|
||
var newFragments = {}, newContentEls; | ||
// If content type is text/json (ignoring charset and other parameters) | ||
if(xhr.getResponseHeader('Content-Type').match(/^text\/json[ \t]*;?/i)) { | ||
if(xhr.getResponseHeader('Content-Type').match(/^((text)|(application))\/json[ \t]*;?/i)) { | ||
newFragments = data; | ||
} else { | ||
|
||
// Fall back to replacing the content fragment if HTML is returned | ||
$data = $(data); | ||
var fragment = document.createDocumentFragment(); | ||
jQuery.clean( [ data ], document, fragment, [] ); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
tractorcow
Contributor
|
||
$data = $(jQuery.merge( [], fragment.childNodes )); | ||
|
||
// Try and guess the fragment if none is provided | ||
// TODO: data-pjax-fragment might actually give us the fragment. For now we just check most common case | ||
|
This is a bad idea considering
.clean
was removed in jQuery 1.9 and there's talk of upgrading core jQuery..clean
is non-documented and non-public API so shouldn't be used.you'd want
.parseHTML
instead