From aa3f9a11f57611a6a5a7c03c30fde6451d8f37ed Mon Sep 17 00:00:00 2001 From: Michael Brade Date: Wed, 2 Sep 2015 16:15:31 -0700 Subject: [PATCH] typeof null === 'object', so check for null; allow LiveScript subcomponents --- lib/components.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/components.js b/lib/components.js index 58c92b6d5..6d380fd09 100644 --- a/lib/components.js +++ b/lib/components.js @@ -164,7 +164,7 @@ App.prototype.component = function(viewName, constructor, ns) { if (typeof viewName === 'function') { constructor = viewName; viewName = null; - } else if (typeof viewName === 'object') { + } else if (viewName != null && typeof viewName === 'object') { var keys = Object.keys(viewName); if (keys.length == 1) { constructor = viewName[keys[0]]; @@ -191,7 +191,7 @@ App.prototype.component = function(viewName, constructor, ns) { if (constructor.prototype.name) { viewName = constructor.prototype.name; if (ns) - viewName = ns + ':' + viewName; + viewName = ns + ':' + viewName; var view = this.views.register(viewName); view.template = templates.emptyTemplate; } else { @@ -207,9 +207,8 @@ App.prototype.component = function(viewName, constructor, ns) { // Load sub components var subComponents = constructor.prototype.components; if (subComponents) { - console.log("loading components: ", subComponents); for(var i = 0, len = subComponents.length; i < len; i++) { - this.component(null, subComponents[i], viewName); + this.component(subComponents[i], null, viewName); } }