Skip to content

Commit 57e545f

Browse files
added: other micro optimizations to the loops
1 parent b1e9993 commit 57e545f

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

lib/browser/tag/each.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function _each(dom, parent, expr) {
7575
parent: parent,
7676
isLoop: true,
7777
hasImpl: hasImpl,
78-
root: hasImpl ? dom.cloneNode() : root,
78+
root: dom.cloneNode(),
7979
item: _item
8080
}, dom.innerHTML)
8181
).mount()

test/specs/compiler-browser.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,10 +1298,11 @@ describe('Compiler Browser', function() {
12981298
tag.items.splice(1, 1)
12991299
tag.update()
13001300
expect(tag.root.getElementsByTagName('div').length).to.be(2)
1301-
tag.items.push('baz')
1301+
tag.items.push('active')
13021302
tag.update()
13031303
expect(tag.root.getElementsByTagName('div').length).to.be(3)
1304-
expect(tag.root.getElementsByTagName('div')[2].innerHTML).to.contain('baz')
1304+
expect(tag.root.getElementsByTagName('div')[2].innerHTML).to.contain('active')
1305+
expect(tag.root.getElementsByTagName('div')[2].className).to.be('active')
13051306

13061307
/*
13071308
TODO: keep in sync also the nested custom tags in a loop

test/tag/loop-inherit.tag

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<loop-inherit>
2-
<div each={ item, index in items}>
2+
<div each={ item, index in items} class={ active: item == 'active' }>
33
<loop-inherit-item id={ index } name={ item } nice={ isFun }></loop-inherit-item>
44
</div>
55

0 commit comments

Comments
 (0)