diff --git a/README.md b/README.md index d931eeb5..214d677a 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ mithril.js [![NPM Version](https://img.shields.io/npm/v/mithril.svg)](https://ww ## What is Mithril? -A modern client-side Javascript framework for building Single Page Applications. It's small (8.44 KB gzipped), fast and provides routing and XHR utilities out of the box. +A modern client-side Javascript framework for building Single Page Applications. It's small (8.45 KB gzipped), fast and provides routing and XHR utilities out of the box. Mithril is used by companies like Vimeo and Nike, and open source platforms like Lichess 👍. diff --git a/mithril.js b/mithril.js index 3d5c1d1b..57faabb4 100644 --- a/mithril.js +++ b/mithril.js @@ -916,7 +916,7 @@ var coreRenderer = function($window) { } } function isFormAttribute(vnode, attr) { - return attr === "value" || attr === "checked" || attr === "selectedIndex" || attr === "selected" && vnode.dom === $doc.activeElement + return attr === "value" || attr === "checked" || attr === "selectedIndex" || attr === "selected" && vnode.dom === $doc.activeElement || vnode.dom.parentNode === $doc.activeElement } function isLifecycleMethod(attr) { return attr === "oninit" || attr === "oncreate" || attr === "onupdate" || attr === "onremove" || attr === "onbeforeremove" || attr === "onbeforeupdate" diff --git a/mithril.min.js b/mithril.min.js index f9b5258f..417ab72b 100644 --- a/mithril.min.js +++ b/mithril.min.js @@ -1,8 +1,8 @@ -(function(){function u(a,c,e,f,n,k){return{tag:a,key:c,attrs:e,children:f,text:n,dom:k,domSize:void 0,state:void 0,events:void 0,instance:void 0,skip:!1}}function N(a){for(var c in a)if(D.call(a,c))return!1;return!0}function B(a){var c=arguments[1],e=2;if(null==a||"string"!==typeof a&&"function"!==typeof a&&"function"!==typeof a.view)throw Error("The selector must be either a string or a component.");if("string"===typeof a){var f;if(!(f=O[a])){var n="div";for(var k=[],g={};f=S.exec(a);){var q=f[1], -m=f[2];""===q&&""!==m?n=m:"#"===q?g.id=m:"."===q?k.push(m):"["===f[3][0]&&((q=f[6])&&(q=q.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\")),"class"===f[4]?k.push(q):g[f[4]]=""===q?q:q||!0)}0b.indexOf("?")?"?":"&";b+=e+c}return b}function g(b){try typeof b.user?b.user:void 0,"string"===typeof b.password?b.password:void 0);b.serialize!==JSON.stringify||!f||b.headers&&b.headers.hasOwnProperty("Content-Type")||l.setRequestHeader("Content-Type","application/json; charset=utf-8");b.deserialize!==g||b.headers&&b.headers.hasOwnProperty("Accept")||l.setRequestHeader("Accept","application/json, text/*");b.withCredentials&&(l.withCredentials=b.withCredentials);for(var z in b.headers)({}).hasOwnProperty.call(b.headers,z)&&l.setRequestHeader(z,b.headers[z]); "function"===typeof b.config&&(l=b.config(l,b)||l);l.onreadystatechange=function(){if(!y&&4===l.readyState)try{var a=b.extract!==q?b.extract(l,b):b.deserialize(b.extract(l,b));if(200<=l.status&&300>l.status||304===l.status||W.test(b.url))c(m(b.type,a));else{var f=Error(l.responseText);f.code=l.status;f.response=a;e(f)}}catch(X){e(X)}};f&&null!=b.data?l.send(b.data):l.send()});return!0===b.background?v:y(v)},jsonp:function(b,g){var y=e();b=f(b,g);var q=new c(function(c,e){var f=b.callbackName||"_mithril_"+ Math.round(1E16*Math.random())+"_"+l++,g=a.document.createElement("script");a[f]=function(e){g.parentNode.removeChild(g);c(m(b.type,e));delete a[f]};g.onerror=function(){g.parentNode.removeChild(g);e(Error("JSONP request failed"));delete a[f]};null==b.data&&(b.data={});b.url=n(b.url,b.data);b.data[b.callbackKey||"callback"]=f;g.src=k(b.url,b.data);a.document.documentElement.appendChild(g)});return!0===b.background?q:y(q)},setCompletionCallback:function(b){z=b}}}(window,p),R=function(a){function c(h, -d){if(h.state!==d)throw Error("`vnode.state` must not be modified");}function e(h){var d=h.state;try{return this.apply(d,arguments)}finally{c(h,d)}}function f(h,d,b,a,c,e,f){for(;b=t&&x>=r;){var w= -d[t],p=a[r];if(w!==p||c)if(null==w)t++;else if(null==p)r++;else if(w.key===p.key){var C=null!=q&&t>=d.length-q.length||null==q&&c;t++;r++;m(h,w,p,e,z(d,t,g),C,k);c&&w.tag===p.tag&&b(h,l(w),g)}else if(w=d[v],w!==p||c)if(null==w)v--;else if(null==p)r++;else if(w.key===p.key)C=null!=q&&v>=d.length-q.length||null==q&&c,m(h,w,p,e,z(d,v+1,g),C,k),(c||r=t&&x>=r;){w=d[v];p=a[x];if(w!==p||c)if(null==w)v--;else{if(null!=p)if(w.key=== -p.key)C=null!=q&&v>=d.length-q.length||null==q&&c,m(h,w,p,e,z(d,v+1,g),C,k),c&&w.tag===p.tag&&b(h,l(w),g),null!=w.dom&&(g=w.dom),v--;else{if(!H){H=d;C=v;w={};var u;for(u=0;u=d.length-q.length||null==q&&c,m(h,u,p,e,z(d,v+1,g),C,k),b(h,l(u),g),d[w].skip=!0,null!=u.dom&&(g=u.dom)):g=n(h,p,e,k,g))}x--}else v--,x--;if(x=u&&D>=r;){var w= +d[u],p=a[r];if(w!==p||c)if(null==w)u++;else if(null==p)r++;else if(w.key===p.key){var t=null!=q&&u>=d.length-q.length||null==q&&c;u++;r++;m(h,w,p,e,z(d,u,g),t,k);c&&w.tag===p.tag&&b(h,l(w),g)}else if(w=d[v],w!==p||c)if(null==w)v--;else if(null==p)r++;else if(w.key===p.key)t=null!=q&&v>=d.length-q.length||null==q&&c,m(h,w,p,e,z(d,v+1,g),t,k),(c||r=u&&D>=r;){w=d[v];p=a[D];if(w!==p||c)if(null==w)v--;else{if(null!=p)if(w.key=== +p.key)t=null!=q&&v>=d.length-q.length||null==q&&c,m(h,w,p,e,z(d,v+1,g),t,k),c&&w.tag===p.tag&&b(h,l(w),g),null!=w.dom&&(g=w.dom),v--;else{if(!H){H=d;t=v;w={};var B;for(B=0;B=d.length-q.length||null==q&&c,m(h,B,p,e,z(d,v+1,g),t,k),b(h,l(B),g),d[w].skip=!0,null!=B.dom&&(g=B.dom)):g=n(h,p,e,k,g))}D--}else v--,D--;if(D