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