From 22b790daa3dcf8fe523fc49ca9389b3dcf18d44a Mon Sep 17 00:00:00 2001 From: RubyLouvre Date: Fri, 15 Jul 2016 00:30:28 +0800 Subject: [PATCH] update --- dist/avalon.js | 4 ++-- dist/avalon.modern.js | 4 ++-- dist/avalon.next.js | 4 ++-- dist/avalon.test.js | 6 +++--- karma/directives/for.js | 43 +++++++++++++++++++++++++++++++++++++++++ src/avalon.test.js | 2 +- src/strategy/lexer.js | 2 +- 7 files changed, 54 insertions(+), 11 deletions(-) diff --git a/dist/avalon.js b/dist/avalon.js index 9232cf405..321bbd3dd 100644 --- a/dist/avalon.js +++ b/dist/avalon.js @@ -1,5 +1,5 @@ /*! - * built in 2016-7-14:20 version 2.16 by 司徒正美 + * built in 2016-7-15:0 version 2.16 by 司徒正美 * 修正注释节点包括HTML结构(里面有引号),节点对齐算法崩溃的BUG * 修正tap事件误触发BUG * 升级ms-widget的slot机制,让它们的值也放到组件VM中 @@ -6888,7 +6888,7 @@ return /******/ (function(modules) { // webpackBootstrap collectNodes(node, stack, ret) if (rmsForEnd.test(nodeValue)) { var p = stack.last() - var nodes = p.children + var nodes = p ? p.children: ret markeRepeatRange(nodes, nodes.pop()) } } diff --git a/dist/avalon.modern.js b/dist/avalon.modern.js index b722506c5..733a01d9e 100644 --- a/dist/avalon.modern.js +++ b/dist/avalon.modern.js @@ -1,5 +1,5 @@ /*! - * built in 2016-7-14:20 version 2.16 by 司徒正美 + * built in 2016-7-15:0 version 2.16 by 司徒正美 * 修正注释节点包括HTML结构(里面有引号),节点对齐算法崩溃的BUG * 修正tap事件误触发BUG * 升级ms-widget的slot机制,让它们的值也放到组件VM中 @@ -4661,7 +4661,7 @@ return /******/ (function(modules) { // webpackBootstrap collectNodes(node, stack, ret) if (rmsForEnd.test(nodeValue)) { var p = stack.last() - var nodes = p.children + var nodes = p ? p.children: ret markeRepeatRange(nodes, nodes.pop()) } } diff --git a/dist/avalon.next.js b/dist/avalon.next.js index 7a254d5bc..9de92db86 100644 --- a/dist/avalon.next.js +++ b/dist/avalon.next.js @@ -1,5 +1,5 @@ /*! - * built in 2016-7-14:20 version 2.16 by 司徒正美 + * built in 2016-7-15:0 version 2.16 by 司徒正美 * 修正注释节点包括HTML结构(里面有引号),节点对齐算法崩溃的BUG * 修正tap事件误触发BUG * 升级ms-widget的slot机制,让它们的值也放到组件VM中 @@ -4662,7 +4662,7 @@ return /******/ (function(modules) { // webpackBootstrap collectNodes(node, stack, ret) if (rmsForEnd.test(nodeValue)) { var p = stack.last() - var nodes = p.children + var nodes = p ? p.children: ret markeRepeatRange(nodes, nodes.pop()) } } diff --git a/dist/avalon.test.js b/dist/avalon.test.js index 179e695f8..0a11383f9 100644 --- a/dist/avalon.test.js +++ b/dist/avalon.test.js @@ -1,5 +1,5 @@ /*! - * built in 2016-7-14:20 version 2.16 by 司徒正美 + * built in 2016-7-15:0 version 2.16 by 司徒正美 * 修正注释节点包括HTML结构(里面有引号),节点对齐算法崩溃的BUG * 修正tap事件误触发BUG * 升级ms-widget的slot机制,让它们的值也放到组件VM中 @@ -78,7 +78,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ function(module, exports, __webpack_require__) { /*! - * built in 2016-7-14:20 version 2.16 by 司徒正美 + * built in 2016-7-15:0 version 2.16 by 司徒正美 * 修正注释节点包括HTML结构(里面有引号),节点对齐算法崩溃的BUG * 修正tap事件误触发BUG * 升级ms-widget的slot机制,让它们的值也放到组件VM中 @@ -4740,7 +4740,7 @@ return /******/ (function(modules) { // webpackBootstrap collectNodes(node, stack, ret) if (rmsForEnd.test(nodeValue)) { var p = stack.last() - var nodes = p.children + var nodes = p ? p.children: ret markeRepeatRange(nodes, nodes.pop()) } } diff --git a/karma/directives/for.js b/karma/directives/for.js index 2d94b71ba..521c165c3 100644 --- a/karma/directives/for.js +++ b/karma/directives/for.js @@ -565,4 +565,47 @@ describe('for', function () { done() }, 150) }) + + it('注解for指令嵌套问题', function (done) { + div.innerHTML = heredoc(function () { + /* + + +
+ +

Group这是标题

+ +
内容1
+ + 内容2 {{ (idx1 < 1 ? 'red' : idx1 > 1 ? 'green' : 'blue') + '-' + item2 }} + + + +
+ */ + }) + + vm = avalon.define({ + $id: 'for14', + arr: [ + {a: 'a1', b: 'b1'}, {a: 'a2', b: 'b2'}, {a: 'a3', b: 'b3'} + ] + }); + avalon.scan(div) + setTimeout(function () { + var strongs = div.getElementsByTagName('strong') + expect(strongs.length).to.equal(6) + done() + }, 150) + }) }) \ No newline at end of file diff --git a/src/avalon.test.js b/src/avalon.test.js index ec200654a..a02a23cf0 100644 --- a/src/avalon.test.js +++ b/src/avalon.test.js @@ -1,5 +1,5 @@ -var avalon = require('../dist/avalon') +var avalon = require('../dist/avalon.modern') require('../components/button/index') require('../components/panel/index') diff --git a/src/strategy/lexer.js b/src/strategy/lexer.js index 15c1133de..cfa8d8c58 100644 --- a/src/strategy/lexer.js +++ b/src/strategy/lexer.js @@ -52,7 +52,7 @@ function lexer(str) { collectNodes(node, stack, ret) if (rmsForEnd.test(nodeValue)) { var p = stack.last() - var nodes = p.children + var nodes = p ? p.children: ret markeRepeatRange(nodes, nodes.pop()) } }