#362 add error for selector arg in m()
This commit is contained in:
parent
49e325d9e7
commit
f99308c39c
1 changed files with 1 additions and 0 deletions
|
|
@ -38,6 +38,7 @@ var m = (function app(window, undefined) {
|
||||||
var classAttrName = "class" in attrs ? "class" : "className";
|
var classAttrName = "class" in attrs ? "class" : "className";
|
||||||
var cell = {tag: "div", attrs: {}};
|
var cell = {tag: "div", attrs: {}};
|
||||||
var match, classes = [];
|
var match, classes = [];
|
||||||
|
if (type.call(args[0]) != STRING) throw new Error("selector in m(selector, attrs, children) should be a string")
|
||||||
while (match = parser.exec(args[0])) {
|
while (match = parser.exec(args[0])) {
|
||||||
if (match[1] == "" && match[2]) cell.tag = match[2];
|
if (match[1] == "" && match[2]) cell.tag = match[2];
|
||||||
else if (match[1] == "#") cell.attrs.id = match[2];
|
else if (match[1] == "#") cell.attrs.id = match[2];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue