Skip to content

Commit

Permalink
remove wrong map in empty loop
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrsh committed Jun 13, 2019
1 parent dd31f99 commit 749adf3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
8 changes: 6 additions & 2 deletions packages/moon/dist/moon.js
Original file line number Diff line number Diff line change
Expand Up @@ -1237,8 +1237,12 @@
} // Execute the views of the children.


for (var i = 0; i < nodeChildren.length; i++) {
nodes.push(nodeChildren[i]);
var nodeChildrenLength = nodeChildren.length;

if (nodeChildrenLength !== 0) {
for (var i = 0; i < nodeChildrenLength; i++) {
nodes.push(nodeChildren[i]);
}
}

if (nodes.length === 0) {
Expand Down
2 changes: 1 addition & 1 deletion packages/moon/dist/moon.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions packages/moon/src/executor/executor.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,12 @@ function executeView(nodes) {
}

// Execute the views of the children.
for (let i = 0; i < nodeChildren.length; i++) {
nodes.push(nodeChildren[i]);
const nodeChildrenLength = nodeChildren.length;

if (nodeChildrenLength !== 0) {
for (let i = 0; i < nodeChildrenLength; i++) {
nodes.push(nodeChildren[i]);
}
}

if (nodes.length === 0) {
Expand Down
4 changes: 3 additions & 1 deletion packages/moon/test/performance/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function element(parent) {
attributes: [{name: "id", value: "test"}],
parentNode: parent === undefined ? element(true) : {},
appendChild: function() {},
removeChild: function() {},
replaceChild: function() {}
};
}
Expand All @@ -45,5 +46,6 @@ Moon({
});

for (var i = 0; i < 10000; i++) {
Moon.set({ list: Moon.get.list.concat([7]) });
//Moon.set({ list: Moon.get.list.concat([7]) });
Moon.set({ list: [] });
}

0 comments on commit 749adf3

Please sign in to comment.