From 16d4eb77c8017e0096eb1daa053cf58882420dbb Mon Sep 17 00:00:00 2001 From: Pepe Bawagan Date: Sun, 1 Jun 2014 21:44:10 +0800 Subject: [PATCH 1/4] always use XMLHttpRequest current behavior will use XDomainRequest whenever it is available even though the request is not necessarily CORS. this creates a problem when on certain browsers (e.g. ie10) because: - Access-Control-Allow-Origin header is expected despite the request not being CORS - XDR does not have an onreadystatechange function (http://msdn.microsoft.com/en-us/library/ie/cc288060(v=vs.85).aspx) and use of its proper callback functions appear to have not yet been implemented --- mithril.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mithril.js b/mithril.js index b3b260fd..be9fd8f1 100644 --- a/mithril.js +++ b/mithril.js @@ -453,7 +453,7 @@ Mithril = m = new function app(window) { function identity(value) {return value} function ajax(options) { - var xhr = window.XDomainRequest ? new window.XDomainRequest : new window.XMLHttpRequest + var xhr = new window.XMLHttpRequest xhr.open(options.method, options.url, true, options.user, options.password) xhr.onreadystatechange = function() { if (xhr.readyState === 4) { From 8e13d013576ed4ac64c8f11a9c65af013eea131a Mon Sep 17 00:00:00 2001 From: eddyystop Date: Wed, 4 Jun 2014 12:46:52 -0400 Subject: [PATCH 2/4] Correcting web services unwrapping code doc --- docs/web-services.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/web-services.md b/docs/web-services.md index 96be5349..03254ce9 100644 --- a/docs/web-services.md +++ b/docs/web-services.md @@ -195,7 +195,7 @@ var users = m.request({ return response.data; }, unwrapError: function(response) { - return response.error; + return JSON.parse(response).error; } }); From 4acac9178b80fdb72e584322ed9897075d60ddde Mon Sep 17 00:00:00 2001 From: eddyystop Date: Wed, 11 Jun 2014 08:28:22 -0400 Subject: [PATCH 3/4] Fixing typo in code example --- docs/mithril.module.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/mithril.module.md b/docs/mithril.module.md index a703d69c..43a88691 100644 --- a/docs/mithril.module.md +++ b/docs/mithril.module.md @@ -69,7 +69,7 @@ var dashboard = { return [ m("h1", controller.greeting), - new user.view(controller.user) + user.view(controller.user) ]; } }; From 5336940f2cb815eae1cb1aa35071b215d4ee5419 Mon Sep 17 00:00:00 2001 From: eddyystop Date: Wed, 11 Jun 2014 08:32:07 -0400 Subject: [PATCH 4/4] Undoing a wrong patch --- docs/web-services.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/web-services.md b/docs/web-services.md index 1c93edd0..e3a548ef 100644 --- a/docs/web-services.md +++ b/docs/web-services.md @@ -195,7 +195,7 @@ var users = m.request({ return response.data; }, unwrapError: function(response) { - return JSON.parse(response).error; + return response.error; } });