From 0870839e903fec24710d577f294ea0524de751fb Mon Sep 17 00:00:00 2001 From: Leo Horie Date: Fri, 24 Apr 2015 15:55:11 -0400 Subject: [PATCH] don't allow extract option to break jsonp --- mithril.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mithril.js b/mithril.js index a7e51cef..425c3fec 100644 --- a/mithril.js +++ b/mithril.js @@ -1113,7 +1113,7 @@ var m = (function app(window, undefined) { var isJSONP = xhrOptions.dataType && xhrOptions.dataType.toLowerCase() === "jsonp"; var serialize = xhrOptions.serialize = isJSONP ? identity : xhrOptions.serialize || JSON.stringify; var deserialize = xhrOptions.deserialize = isJSONP ? identity : xhrOptions.deserialize || JSON.parse; - var extract = xhrOptions.extract || function(xhr) { + var extract = isJSONP ? function(jsonp) {return jsonp.responseText} : xhrOptions.extract || function(xhr) { return xhr.responseText.length === 0 && deserialize === JSON.parse ? null : xhr.responseText }; xhrOptions.method = (xhrOptions.method || 'GET').toUpperCase();