diff --git a/README.md b/README.md index 881fab6e..5f5e96ac 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.89 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.90 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 5f87c706..6611f9d9 100644 --- a/mithril.js +++ b/mithril.js @@ -1240,7 +1240,7 @@ var coreRenderer = function($window) { updateNodes(dom, dom.vnodes, Vnode.normalizeChildren(vnodes), hooks, null, namespace === "http://www.w3.org/1999/xhtml" ? undefined : namespace) dom.vnodes = vnodes // document.activeElement can return null in IE https://developer.mozilla.org/en-US/docs/Web/API/Document/activeElement - if (active != null && $doc.activeElement !== active) active.focus() + if (active != null && $doc.activeElement !== active && typeof active.focus === "function") active.focus() for (var i = 0; i < hooks.length; i++) hooks[i]() } return {render: render, setEventCallback: setEventCallback} diff --git a/mithril.min.js b/mithril.min.js index 71795996..e8c9051b 100644 --- a/mithril.min.js +++ b/mithril.min.js @@ -36,13 +36,13 @@ null!==c&&a.dom.value===e||"option"===a.tag&&null!==c&&a.dom.value===e))return;" (a.style[d]="")}else if(b===c&&(a.style.cssText="",b=null),null==c)a.style.cssText="";else if("string"===typeof c)a.style.cssText=c;else for(d in"string"===typeof b&&(a.style.cssText=""),c)a.style[d]=c[d]}function M(){}function U(a,b,c){null!=a.events?a.events[b]!==c&&(null==c||"function"!==typeof c&&"object"!==typeof c?(null!=a.events[b]&&a.dom.removeEventListener(b.slice(2),a.events,!1),a.events[b]=void 0):(null==a.events[b]&&a.dom.addEventListener(b.slice(2),a.events,!1),a.events[b]=c)):null== c||"function"!==typeof c&&"object"!==typeof c||(a.events=new M,a.dom.addEventListener(b.slice(2),a.events,!1),a.events[b]=c)}function N(a,b,c){"function"===typeof a.oninit&&e.call(a.oninit,b);"function"===typeof a.oncreate&&c.push(e.bind(a.oncreate,b))}function L(a,b,c){"function"===typeof a.onupdate&&c.push(e.bind(a.onupdate,b))}var D=a.document;D.createDocumentFragment();var H={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"},I,J={caption:"table",thead:"table",tbody:"table", tfoot:"table",tr:"tbody",th:"tr",td:"tr",colgroup:"table",col:"colgroup"};M.prototype=Object.create(null);M.prototype.handleEvent=function(a){var b=this["on"+a.type];"function"===typeof b?b.call(a.target,a):"function"===typeof b.handleEvent&&b.handleEvent(a);"function"===typeof I&&I.call(a.target,a)};return{render:function(a,b){if(!a)throw Error("Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.");var c=[],d=D.activeElement,e=a.namespaceURI;null==a.vnodes&&(a.textContent= -"");Array.isArray(b)||(b=[b]);k(a,a.vnodes,z.normalizeChildren(b),c,null,"http://www.w3.org/1999/xhtml"===e?void 0:e);a.vnodes=b;null!=d&&D.activeElement!==d&&d.focus();for(d=0;d