From 542b87889b20d9f6170ae8c12e46cdd2946a31bb Mon Sep 17 00:00:00 2001 From: mpfau Date: Thu, 19 Jan 2017 19:04:53 +0100 Subject: [PATCH 1/3] docs: fix onremove lifecycle doc (#1552) Fixed the description of onremove to match the current implementation of onbeforeremove (promise vs. done callback) --- docs/lifecycle-methods.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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. From f59402718b1385dba1e48b50d791ed8e1f302342 Mon Sep 17 00:00:00 2001 From: maks feltrin Date: Mon, 23 Jan 2017 11:54:35 +0100 Subject: [PATCH 2/3] check that selector.view is a function --- render/hyperscript.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/render/hyperscript.js b/render/hyperscript.js index a2cf7332..a59bba45 100644 --- a/render/hyperscript.js +++ b/render/hyperscript.js @@ -5,7 +5,7 @@ var Vnode = require("../render/vnode") 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."); } From 233d92b732fca77539ccac64a5dc75e0b9c3cbc4 Mon Sep 17 00:00:00 2001 From: Gandalf-the-Bot Date: Mon, 23 Jan 2017 15:53:59 +0000 Subject: [PATCH 3/3] Bundled output for commit 1d608b6613c4d35e7d7b4e34318c055c3a44a492 [skip ci] --- mithril.js | 2 +- mithril.min.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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