From 0fad68fa695d30ad85615aa42b9af038c142af7c Mon Sep 17 00:00:00 2001 From: Barney Carroll Date: Sat, 12 Nov 2016 22:12:03 +0000 Subject: [PATCH 1/4] Method defaults to GET as of #1393 (#1394) --- docs/request.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/request.md b/docs/request.md index 8a52c357..4083add4 100644 --- a/docs/request.md +++ b/docs/request.md @@ -23,7 +23,7 @@ Argument | Type | Required | Description ---------------------- | --------------------------------- | -------- | --- `url` | `String` | No | If present, it's equivalent to having the options `{method: "GET", url: url}`. Values passed to the `options` argument override options set via this shorthand. -`options.method` | `String` | Yes | The HTTP method to use. This value should be one of the following: `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `HEAD` or `OPTIONS`. +`options.method` | `String` | No | The HTTP method to use. This value should be one of the following: `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `HEAD` or `OPTIONS`. Defaults to `GET`. `options.url` | `String` | Yes | The URL to send the request to. The URL may be either absolute or relative, and it may contain [interpolations](#dynamic-urls). `options.data` | `any` | No | The data to be interpolated into the URL and serialized into the querystring (for GET requests) or body (for other types of requests). `options.async` | `Boolean` | No | Whether the request should be asynchronous. Defaults to `true`. From d539c515eac980b74e4c9b3dfec6e6f3c27d272d Mon Sep 17 00:00:00 2001 From: Thibault Duplessis Date: Sun, 13 Nov 2016 11:30:22 +0100 Subject: [PATCH 2/4] Test SVG update element with tag change Currently failing. Updating an SVG element which tag changes actually results in an unknown HTML element. --- render/tests/test-updateElement.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/render/tests/test-updateElement.js b/render/tests/test-updateElement.js index 28ba84ff..2211efd1 100644 --- a/render/tests/test-updateElement.js +++ b/render/tests/test-updateElement.js @@ -211,6 +211,19 @@ o.spec("updateElement", function() { o(updated.dom.attributes["class"].nodeValue).equals("b") }) + o("updates svg child", function() { + var vnode = {tag: "svg", children: [{ + tag: 'circle' + }]} + var updated = {tag: "svg", children: [{ + tag: 'line' + }]} + + render(root, [vnode]) + render(root, [updated]) + + o(updated.dom.firstChild.namespaceURI).equals("http://www.w3.org/2000/svg") + }) o("restores correctly when recycling", function() { var vnode = {tag: "div", key: 1} var updated = {tag: "div", key: 2} From 7163d5f7446a05578d2dddb9bfe854c935ce889a Mon Sep 17 00:00:00 2001 From: Thibault Duplessis Date: Sun, 13 Nov 2016 11:31:55 +0100 Subject: [PATCH 3/4] Fix SVG element update with tag change Fixes the new failing test. Before: the updated element is unknown HTML After: the updated element is an SVG element --- render/render.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/render/render.js b/render/render.js index 9445522b..c2dbd4ca 100644 --- a/render/render.js +++ b/render/render.js @@ -213,7 +213,7 @@ module.exports = function($window) { } else { removeNode(old, null) - insertNode(parent, createNode(vnode, hooks, undefined), nextSibling) + insertNode(parent, createNode(vnode, hooks, ns), nextSibling) } } function updateText(old, vnode) { From 6ed9bb87ca491d64d2525f6f16aabde6ad722b4d Mon Sep 17 00:00:00 2001 From: Gandalf-the-Bot Date: Sun, 13 Nov 2016 13:18:11 +0000 Subject: [PATCH 4/4] Bundled output for commit 030814015617e7c45f214cdb5f9e5f37eac51a38 [skip ci] --- mithril.js | 2 +- mithril.min.js | 78 +++++++++++++++++++++++++------------------------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/mithril.js b/mithril.js index b2996cbf..908863a4 100644 --- a/mithril.js +++ b/mithril.js @@ -626,7 +626,7 @@ var _14 = function($window) { } else { removeNode(old, null) - insertNode(parent0, createNode(vnode, hooks, undefined), nextSibling) + insertNode(parent0, createNode(vnode, hooks, ns), nextSibling) } } function updateText(old, vnode) { diff --git a/mithril.min.js b/mithril.min.js index daac7489..63654ed1 100644 --- a/mithril.min.js +++ b/mithril.min.js @@ -1,44 +1,44 @@ -new function(){function u(c,f,n,g,k,h){return{tag:c,key:f,attrs:n,children:g,text:k,dom:h,domSize:void 0,state:{},events:void 0,instance:void 0,skip:!1}}function v(c){if(null==c||"string"!==typeof c&&null==c.view)throw Error("The selector must be either a string or a component.");if("string"===typeof c&&void 0===K[c]){for(var f,n,g=[],k={};f=R.exec(c);){var h=f[1],x=f[2];""===h&&""!==x?n=x:"#"===h?k.id=x:"."===h?g.push(x):"["===f[3][0]&&((h=f[6])&&(h=h.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\")), -k[f[4]]=h||!0)}0e.filter(I).length)throw Error("Ensure that each item passed to m.prop.combine/m.prop.merge is a stream"); -return r(f(),e,function(){var m=e.filter(d);if(0e.indexOf("?")?"?":"&";e+=g+f}return e}function k(e){try{return""!==e?JSON.parse(e):null}catch(w){throw Error(e);}}function h(e){return e.responseText}function x(e,c){if("function"===typeof e)if(c instanceof Array)for(var f=0;fp.status||304===p.status)A(x(e.type,c));else{var f=Error(p.responseText),g;for(g in c)f[g]=c[g];A.error(f)}}catch(S){A.error(S)}"function"===typeof t&&t()}};l&&null!=e.data?p.send(e.data):p.send();return A},jsonp:function(e){var h=f();void 0!==e.initialValue&&h(e.initialValue);var l=e.callbackName||"_mithril_"+ -Math.round(1E16*Math.random())+"_"+z++,k=c.document.createElement("script");c[l]=function(f){k.parentNode.removeChild(k);h(x(e.type,f));"function"===typeof t&&t();delete c[l]};k.onerror=function(){k.parentNode.removeChild(k);h.error(Error("JSONP request failed"));"function"===typeof t&&t();delete c[l]};null==e.data&&(e.data={});e.url=n(e.url,e.data);e.data[e.callbackKey||"callback"]=l;k.src=g(e.url,e.data);c.document.documentElement.appendChild(k);return h},setCompletionCallback:function(e){t=e}}}(window, -P),M=function(){var c=[];return{subscribe:c.push.bind(c),unsubscribe:function(f){f=c.indexOf(f);-1e.filter(I).length)throw Error("Ensure that each item passed to m.prop.combine/m.prop.merge is a stream"); +return t(f(),e,function(){var l=e.filter(d);if(0e.indexOf("?")?"?":"&";e+=g+f}return e}function k(e){try{return""!==e?JSON.parse(e):null}catch(w){throw Error(e);}}function h(e){return e.responseText}function y(e,c){if("function"===typeof e)if(c instanceof Array)for(var f=0;fu.status||304===u.status)B(y(e.type,c));else{var f=Error(u.responseText),g;for(g in c)f[g]=c[g];B.error(f)}}catch(S){B.error(S)}"function"===typeof q&&q()}};m&&null!=e.data?u.send(e.data):u.send();return B},jsonp:function(e){var h=f();void 0!==e.initialValue&&h(e.initialValue);var m=e.callbackName||"_mithril_"+ +Math.round(1E16*Math.random())+"_"+A++,k=c.document.createElement("script");c[m]=function(f){k.parentNode.removeChild(k);h(y(e.type,f));"function"===typeof q&&q();delete c[m]};k.onerror=function(){k.parentNode.removeChild(k);h.error(Error("JSONP request failed"));"function"===typeof q&&q();delete c[m]};null==e.data&&(e.data={});e.url=n(e.url,e.data);e.data[e.callbackKey||"callback"]=m;k.src=g(e.url,e.data);c.document.documentElement.appendChild(k);return h},setCompletionCallback:function(e){q=e}}}(window, +P),M=function(){var c=[];return{subscribe:c.push.bind(c),unsubscribe:function(f){f=c.indexOf(f);-1=q&&k>=B;){var r=b[q],y=d[B];if(r!==y||m)if(null!=r&&null!=y&&r.key===y.key)q++,B++,h(a,r,y,c,z(b,q,e),m,g),m&&r.tag===y.tag&&t(a,x(r),e);else if(r= -b[l],r!==y||m)if(null!=r&&null!=y&&r.key===y.key)h(a,r,y,c,z(b,l+1,e),m,g),(m||B=q&&k>=B;){r=b[l];y=d[k];if(r!==y||m)if(null!=r&&null!=y&&r.key===y.key)h(a,r,y,c,z(b,l+1,e),m,g),m&&r.tag===y.tag&&t(a,x(r),e),null!=r.dom&&(e=r.dom),l--;else{if(!p){p=b;var r=l,u={},A;for(A=0;A=p&&x>=m;){var t=b[p],z=d[m];if(t!==z||l)if(null!=t&&null!=z&&t.key===z.key)p++,m++,h(a,t,z,c,A(b,p,e),l,g),l&&t.tag===z.tag&&q(a,y(t),e);else if(t= +b[k],t!==z||l)if(null!=t&&null!=z&&t.key===z.key)h(a,t,z,c,A(b,k+1,e),l,g),(l||m=p&&x>=m;){t=b[k];z=d[x];if(t!==z||l)if(null!=t&&null!=z&&t.key===z.key)h(a,t,z,c,A(b,k+1,e),l,g),l&&t.tag===z.tag&&q(a,y(t),e),null!=t.dom&&(e=t.dom),k--;else{if(!u){u=b;var t=k,r={},B;for(B=0;B