From 94a32d7f18d9f6afc5314a3899390392138aa133 Mon Sep 17 00:00:00 2001 From: popomore Date: Fri, 7 Mar 2014 14:09:06 +0800 Subject: [PATCH] fix for in array --- HISTORY.md | 4 ++++ src/autocomplete.js | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 3b3f970..b7bbd2f 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -2,6 +2,10 @@ --- +## 1.3.1 + +`tag:fixed` 修复 for/in 数组的 bug + ## 1.3.0 `tag:changed` 大范围的重构,很多细节有变化,可以按照新文档开发。 diff --git a/src/autocomplete.js b/src/autocomplete.js index 6781fc2..28c0e96 100644 --- a/src/autocomplete.js +++ b/src/autocomplete.js @@ -72,11 +72,11 @@ define(function(require, exports, module) { }, parseElement: function() { - var t = ['header', 'footer', 'html']; - for (var i in t) { - this.templatePartials || (this.templatePartials = {}); - this.templatePartials[t[i]] = this.get(t[i]); - } + var that = this; + this.templatePartials || (this.templatePartials = {}); + $.each(['header', 'footer', 'html'], function( index, item ) { + that.templatePartials[item] = that.get(item); + }); AutoComplete.superclass.parseElement.call(this); },