From 90c5c41e2d35525142858897a2492fedc83e2fca Mon Sep 17 00:00:00 2001 From: uc2dabing Date: Tue, 14 May 2013 13:19:53 +0800 Subject: [PATCH] Update template.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 如果模板出现类似if(0==i)或者if(0===i)的时候,提取变量bug,会把0也作为变量提取出来。 --- template.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/template.js b/template.js index eba78e76..d3376d71 100644 --- a/template.js +++ b/template.js @@ -333,7 +333,8 @@ var _compile = (function () { code = code .replace(filter, ',') .replace(/[^\w\$]+/g, ',') - .replace(/^,|^\d+|,\d+|,$/g, ''); + .replace(/^\d+|,\d+|^,|,$/g, '') + .replace(/^,*|,*$/, ''); return code ? code.split(',') : []; };