From e737ce214eb59b552e6c7dd074c4f4d719bb31d4 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Sun, 10 Jun 2012 16:32:34 -0700 Subject: Hintable - Array type check fix for arrays created with map() method. --- js/components/hintable.reel/hintable.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'js/components/hintable.reel/hintable.js') diff --git a/js/components/hintable.reel/hintable.js b/js/components/hintable.reel/hintable.js index 803770db..e16c5f8a 100644 --- a/js/components/hintable.reel/hintable.js +++ b/js/components/hintable.reel/hintable.js @@ -185,12 +185,12 @@ exports.Hintable = Montage.create(Editable, { handleInput : { value : function handleInput(e) { this._super(arguments); - + var val = this.value, matches, hint; //console.log('val = "' + val + '"'); //// Handle auto-suggest if configured - if(this.hints instanceof Array) { + if(this.hints && this.hints.length) { if(val.length > 0) { // content is not empty @@ -305,7 +305,8 @@ exports.Hintable = Montage.create(Editable, { /* --------- CONFIG ---------- */ hints : { - value : ['Testing a hint.', 'Testing another hint.', 'Testing the last hint.'] + value : ['Testing a hint.', 'Testing another hint.', 'Testing the last hint.'], + distinct: true }, hintClass : { value : "hintable-hint" -- cgit v1.2.3 From a0079f570ce996cb5acbf050a7abb1df1ad788eb Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Mon, 18 Jun 2012 18:56:04 -0700 Subject: Hintable - Fix editable/hintable value property so it is bindable. --- js/components/hintable.reel/hintable.js | 36 +-------------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) (limited to 'js/components/hintable.reel/hintable.js') diff --git a/js/components/hintable.reel/hintable.js b/js/components/hintable.reel/hintable.js index e16c5f8a..d09cdbd2 100644 --- a/js/components/hintable.reel/hintable.js +++ b/js/components/hintable.reel/hintable.js @@ -140,15 +140,6 @@ exports.Hintable = Montage.create(Editable, { } } }, - value : { - get: function() { - return this._getFirstTextNode().textContent; - }, - set: function(str) { - var node = this._getFirstTextNode(); - node.textContent = str; - } - }, handleKeydown : { value : function handleKeydown(e) { @@ -196,6 +187,7 @@ exports.Hintable = Montage.create(Editable, { this._matchIndex = 0; this.matches = this.hints.filter(function(h) { + if(!h) { return false; } return h.indexOf(val) === 0; }).sort(); @@ -271,32 +263,6 @@ exports.Hintable = Montage.create(Editable, { return Array.prototype.slice.call(arrayLikeObj); } }, - _getFirstTextNode : { - value : function(el) { - ///// optional el argument specified container element - var e = el || this._element, - nodes = e.childNodes, node; - - if(nodes.length) { - for(var i=0; i