From 27e98e6fc3407c50c8d10666c78c0923e3d83e5d Mon Sep 17 00:00:00 2001 From: Skyler Date: Tue, 18 Oct 2016 13:54:18 -0700 Subject: [PATCH 1/6] Ignore modifier+click and middle click in m.route.link Currently, middle clicking and ctrl+click change the route in the current tab. Expected behavior is to open a new tab/window. --- router/router.js | 1 + 1 file changed, 1 insertion(+) diff --git a/router/router.js b/router/router.js index 7c6aaadc..51f62984 100644 --- a/router/router.js +++ b/router/router.js @@ -112,6 +112,7 @@ module.exports = function($window) { function link(vnode) { vnode.dom.setAttribute("href", prefix + vnode.attrs.href) vnode.dom.onclick = function(e) { + if (e.ctrlKey || e.metaKey || e.shiftKey || e.which === 2) return e.preventDefault() e.redraw = false var href = this.getAttribute("href") From ce93bdbb793eb64e9f4c49efdb9e607a954a37df Mon Sep 17 00:00:00 2001 From: maks feltrin Date: Sat, 22 Oct 2016 04:04:47 +0200 Subject: [PATCH 2/6] rename ctrl to state I am not sure you agree, but i find the name `state` a bit less confusing that the name `ctrl` used in v 0.2.x. thank you and kind regards --- docs/v1.x-migration.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/v1.x-migration.md b/docs/v1.x-migration.md index 3bbe31a7..ca1a1efb 100644 --- a/docs/v1.x-migration.md +++ b/docs/v1.x-migration.md @@ -134,15 +134,15 @@ m.mount(document.body, { m.mount(document.body, { oninit : function(vnode) { - var ctrl = this; // this is bound to vnode.state by default + var state = this; // this is bound to vnode.state by default - ctrl.fooga = 1; + state.fooga = 1; }, view : function(vnode) { - var ctrl = this; // this is bound to vnode.state by default + var state = this; // this is bound to vnode.state by default - return m("p", ctrl.fooga); + return m("p", state.fooga); } }); ``` From df517bf63648a32875d480869422d8808a360b7f Mon Sep 17 00:00:00 2001 From: maks feltrin Date: Sat, 22 Oct 2016 16:45:19 +0200 Subject: [PATCH 3/6] docs typo? --- docs/components.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/components.md b/docs/components.md index 268fdd40..7f5d561f 100644 --- a/docs/components.md +++ b/docs/components.md @@ -83,7 +83,7 @@ The state of a component can be accessed three ways: as a blueprint at initializ Any property attached to the component object is deep-cloned for every instance of the component. This allows simple state initialization. -In the example below, `data` is a property of the `Input` component's state object. +In the example below, `data` is a property of the `ComponentWithInitialState` component's state object. ```javascript var ComponentWithInitialState = { From 93062d6c6a49b84ee8a95b7b54a175278b31d20f Mon Sep 17 00:00:00 2001 From: maks feltrin Date: Sat, 22 Oct 2016 23:48:55 +0200 Subject: [PATCH 4/6] docs/prop.md typo --- docs/prop.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/prop.md b/docs/prop.md index 035ebc66..9ae320f3 100644 --- a/docs/prop.md +++ b/docs/prop.md @@ -49,7 +49,7 @@ Argument | Type | Required | Description Creates a computed stream that reactively updates if any of its upstreams are updated. See [combining streams](#combining-streams) -`stream = prop.combine(combiner, streams)` +`stream = m.prop.combine(combiner, streams)` Argument | Type | Required | Description ----------- | --------------------------- | -------- | --- From 44cc77e021c0fdc7a17244f3b7578300abab0ca7 Mon Sep 17 00:00:00 2001 From: maks feltrin Date: Sun, 23 Oct 2016 17:43:46 +0200 Subject: [PATCH 5/6] #rewrite docs prop.md typo --- docs/prop.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/prop.md b/docs/prop.md index 035ebc66..ed27a3d0 100644 --- a/docs/prop.md +++ b/docs/prop.md @@ -555,7 +555,7 @@ var errored2 = m.prop.combine(function(stream) { if (typeof stream() !== "string") { throw new Error("Not a string") } - return value + return stream() }, [stream]) // errored2 is in an errored state ``` From c3a72d5eb2411bf280f38db962eede15db0bb5cc Mon Sep 17 00:00:00 2001 From: Gandalf-the-Bot Date: Mon, 24 Oct 2016 14:28:20 +0000 Subject: [PATCH 6/6] Bundled output for commit 318ed04b4a6da38212bd34e3772b889e0589a3d0 [skip ci] --- mithril.js | 1 + mithril.min.js | 85 +++++++++++++++++++++++++------------------------- 2 files changed, 44 insertions(+), 42 deletions(-) diff --git a/mithril.js b/mithril.js index 1344ecd3..c9fede49 100644 --- a/mithril.js +++ b/mithril.js @@ -1117,6 +1117,7 @@ var coreRouter = function($window) { function link(vnode2) { vnode2.dom.setAttribute("href", prefix1 + vnode2.attrs.href) vnode2.dom.onclick = function(e) { + if (e.ctrlKey || e.metaKey || e.shiftKey || e.which === 2) return e.preventDefault() e.redraw = false var href = this.getAttribute("href") diff --git a/mithril.min.js b/mithril.min.js index 81eabc6c..3b1164b8 100644 --- a/mithril.min.js +++ b/mithril.min.js @@ -1,42 +1,43 @@ -new function(){function u(b,e,n,f,k,h){return{tag:b,key:e,attrs:n,children:f,text:k,dom:h,domSize:void 0,state:{},events:void 0,instance:void 0,skip:!1}}function x(b){if(null==b||"string"!==typeof b&&null==b.view)throw Error("The selector must be either a string or a component.");if("string"===typeof b&&void 0===F[b]){for(var e,n,f=[],k={};e=O.exec(b);){var h=e[1],m=e[2];""===h&&""!==m?n=m:"#"===h?k.id=m:"."===h?f.push(m):"["===e[3][0]&&((h=e[6])&&(h=h.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\")), -k[e[4]]=h||!0)}0d.filter(D).length)throw Error("Ensure that each item passed to m.prop.combine/m.prop.merge is a stream");return A(e(),d,function(){var b= -d.filter(L);if(0b.indexOf("?")?"?":"&";b+=h+f}return b}function k(b){try{return""!==b?JSON.parse(b):null}catch(e){throw Error(b);}}function h(b){return b.responseText}function m(b,e){if("function"===typeof b)if(e instanceof Array)for(var f=0;fr.status||304=== -r.status)l(m(g.type,b));else{var e=Error(r.responseText),f;for(f in b)e[f]=b[f];l.error(e)}}catch(w){l.error(w)}"function"===typeof p&&p()}};w?r.send(g.data):r.send();return l},jsonp:function(g){var h=e();void 0!==g.initialValue&&h(g.initialValue);var w=g.callbackName||"_mithril_"+Math.round(1E16*Math.random())+"_"+t++,k=b.document.createElement("script");b[w]=function(e){k.parentNode.removeChild(k);h(m(g.type,e));"function"===typeof p&&p();delete b[w]};k.onerror=function(){k.parentNode.removeChild(k); -h.error(Error("JSONP request failed"));"function"===typeof p&&p();delete b[w]};null==g.data&&(g.data={});g.url=n(g.url,g.data);g.data[g.callbackKey||"callback"]=w;k.src=f(g.url,g.data);b.document.documentElement.appendChild(k);return h},setCompletionCallback:function(b){p=b}}}(window,M),I=function(){var b=[];return{subscribe:b.push.bind(b),unsubscribe:function(e){e=b.indexOf(e);-1=l&&A>=w;){var y=a[l],q=d[w];if(y!==q||v)if(null!=y&&null!=q&&y.key===q.key)l++,w++,h(c,y,q,b,t(a,l,f),v,k),v&&y.tag===q.tag&&p(c,m(y),f);else if(y=a[r],y!==q||v)if(null!=y&&null!=q&&y.key===q.key)h(c,y,q,b,t(a,r+1,f),v,k),(v||w=l&&A>=w;){y=a[r];q=d[A];if(y!==q||v)if(null!=y&&null!=q&&y.key===q.key)h(c,y,q,b,t(a,r+1,f),v,k),v&&y.tag===q.tag&&p(c,m(y),f),null!=y.dom&&(f=y.dom),r--;else{if(!B){B=a;var y=r,u={},x;for(x= -0;xd.filter(D).length)throw Error("Ensure that each item passed to m.prop.combine/m.prop.merge is a stream");return z(e(),d,function(){var b= +d.filter(L);if(0b.indexOf("?")?"?":"&";b+=h+f}return b}function k(b){try{return""!==b?JSON.parse(b):null}catch(e){throw Error(b);}}function h(b){return b.responseText}function l(b,e){if("function"===typeof b)if(e instanceof Array)for(var f=0;fr.status||304=== +r.status)v(l(g.type,b));else{var e=Error(r.responseText),f;for(f in b)e[f]=b[f];v.error(e)}}catch(p){v.error(p)}"function"===typeof q&&q()}};p?r.send(g.data):r.send();return v},jsonp:function(g){var h=e();void 0!==g.initialValue&&h(g.initialValue);var p=g.callbackName||"_mithril_"+Math.round(1E16*Math.random())+"_"+m++,k=b.document.createElement("script");b[p]=function(e){k.parentNode.removeChild(k);h(l(g.type,e));"function"===typeof q&&q();delete b[p]};k.onerror=function(){k.parentNode.removeChild(k); +h.error(Error("JSONP request failed"));"function"===typeof q&&q();delete b[p]};null==g.data&&(g.data={});g.url=n(g.url,g.data);g.data[g.callbackKey||"callback"]=p;k.src=f(g.url,g.data);b.document.documentElement.appendChild(k);return h},setCompletionCallback:function(b){q=b}}}(window,M),I=function(){var b=[];return{subscribe:b.push.bind(b),unsubscribe:function(e){e=b.indexOf(e);-1=p&&z>=v;){var y=a[p],t=d[v];if(y!==t||u)if(null!=y&&null!=t&&y.key===t.key)p++,v++,h(c,y,t,b,m(a,p,f),u,k),u&&y.tag===t.tag&&q(c,l(y),f);else if(y=a[r],y!==t||u)if(null!=y&&null!=t&&y.key===t.key)h(c,y,t,b,m(a,r+1,f),u,k),(u||v=p&&z>=v;){y=a[r];t=d[z];if(y!==t||u)if(null!=y&&null!=t&&y.key===t.key)h(c,y,t,b,m(a,r+1,f),u,k),u&&y.tag===t.tag&&q(c,l(y),f),null!=y.dom&&(f=y.dom),r--;else{if(!A){A=a;var y=r,w={},x;for(x= +0;x