Support classes and factories as components (#1339)

* Support classes and factories as components

* Tests for class and factory component support
This commit is contained in:
Pierre-Yves Gérardy 2017-02-15 04:48:02 +01:00 committed by Isiah Meadows
parent ff16c7f47a
commit 3f3af74dde
5 changed files with 301 additions and 16 deletions

View file

@ -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" && typeof selector.view !== "function") {
if (selector == null || typeof selector !== "string" && typeof selector !== "function" && typeof selector.view !== "function") {
throw Error("The selector must be either a string or a component.");
}