From f99308c39ca0e7ce5786d8232aa10fe50fab8ef8 Mon Sep 17 00:00:00 2001 From: Leo Horie Date: Fri, 28 Nov 2014 12:45:41 -0500 Subject: [PATCH] #362 add error for selector arg in m() --- mithril.js | 1 + 1 file changed, 1 insertion(+) diff --git a/mithril.js b/mithril.js index 491b63f3..49c8c35d 100644 --- a/mithril.js +++ b/mithril.js @@ -38,6 +38,7 @@ var m = (function app(window, undefined) { var classAttrName = "class" in attrs ? "class" : "className"; var cell = {tag: "div", attrs: {}}; 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])) { if (match[1] == "" && match[2]) cell.tag = match[2]; else if (match[1] == "#") cell.attrs.id = match[2];