diff --git a/docs/lifecycle-methods.md b/docs/lifecycle-methods.md index a7eb2315..cac48a82 100644 --- a/docs/lifecycle-methods.md +++ b/docs/lifecycle-methods.md @@ -154,7 +154,7 @@ var Fader = { ### onremove -The `onremove(vnode)` hook is called before a DOM element is removed from the document. If a `onbeforeremove` hook is also defined, the `onremove` hook runs after the `done` callback is called. +The `onremove(vnode)` hook is called before a DOM element is removed from the document. If a `onbeforeremove` hook is also defined, the `onremove` hook runs after the promise returned from `onbeforeremove` is completed. This hook is called on any element that is removed from the document, regardless of whether it was directly detached from its parent or whether it is a child of another element that was detached. diff --git a/mithril.js b/mithril.js index d1ad697b..99b78f62 100644 --- a/mithril.js +++ b/mithril.js @@ -17,7 +17,7 @@ Vnode.normalizeChildren = function normalizeChildren(children) { var selectorParser = /(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g var selectorCache = {} function hyperscript(selector) { - if (selector == null || typeof selector !== "string" && selector.view == null) { + if (selector == null || typeof selector !== "string" && typeof selector.view !== "function") { throw Error("The selector must be either a string or a component."); } if (typeof selector === "string" && selectorCache[selector] === undefined) { diff --git a/mithril.min.js b/mithril.min.js index 380a3621..9fe4f6ed 100644 --- a/mithril.min.js +++ b/mithril.min.js @@ -1,5 +1,5 @@ -new function(){function u(a,c,m,d,h,n){return{tag:a,key:c,attrs:m,children:d,text:h,dom:n,domSize:void 0,state:{},events:void 0,instance:void 0,skip:!1}}function B(a){if(null==a||"string"!==typeof a&&null==a.view)throw Error("The selector must be either a string or a component.");if("string"===typeof a&&void 0===G[a]){for(var c,m,d=[],h={};c=N.exec(a);){var n=c[1],q=c[2];""===n&&""!==q?m=q:"#"===n?h.id=q:"."===n?d.push(q):"["===c[3][0]&&((n=c[6])&&(n=n.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\")), -"class"===c[4]?d.push(n):h[c[4]]=n||!0)}0