proper selector check (#1231)

This commit is contained in:
suren shrestha 2016-08-11 02:41:58 +05:45 committed by Pat Cavit
parent c4a710e61c
commit b2189a524f

View file

@ -5,6 +5,10 @@ var Vnode = require("../render/vnode")
var selectorParser = /(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g
var selectorCache = {}
function hyperscript(selector) {
if (selector == null || typeof selector !== "string" && !selector.view) {
throw Error("The selector must be either a string or a component.");
}
if (typeof selector === "string") {
if (selectorCache[selector] === undefined) {
var match, tag, classes = [], attributes = {}