proper selector check (#1231)
This commit is contained in:
parent
c4a710e61c
commit
b2189a524f
1 changed files with 4 additions and 0 deletions
|
|
@ -5,6 +5,10 @@ var Vnode = require("../render/vnode")
|
||||||
var selectorParser = /(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g
|
var selectorParser = /(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g
|
||||||
var selectorCache = {}
|
var selectorCache = {}
|
||||||
function hyperscript(selector) {
|
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 (typeof selector === "string") {
|
||||||
if (selectorCache[selector] === undefined) {
|
if (selectorCache[selector] === undefined) {
|
||||||
var match, tag, classes = [], attributes = {}
|
var match, tag, classes = [], attributes = {}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue