From 61c37f0858e37a61d13cfd2f6ba3fcbc33903077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Wed, 14 Nov 2012 18:34:27 -0800 Subject: [PATCH] Improve component type guessing. --- src/ui/Component.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ui/Component.js b/src/ui/Component.js index e751ba51..a5a79a4d 100644 --- a/src/ui/Component.js +++ b/src/ui/Component.js @@ -59,12 +59,13 @@ var Component = this.Component = Base.extend(Callback, /** @lends Component# */{ }, initialize: function(obj) { - this._type = obj.type - || ('options' in obj + this._type = obj.type in this._types + ? obj.type + : 'options' in obj ? 'list' : 'onClick' in obj ? 'button' - : typeof value); + : typeof obj.value; this._info = this._types[this._type] || { type: this._type }; var that = this, fireChange = false;