Skip to content

Commit

Permalink
Using while instead of for loop when utilizing node
Browse files Browse the repository at this point in the history
  • Loading branch information
bemson committed Feb 23, 2014
1 parent df0db33 commit d5ef18c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/salt.js
Expand Up @@ -1569,7 +1569,8 @@
node.reds = []; node.reds = [];


// run core tags // run core tags
for (j = 0; j < coreTagKeyCount; j++) { j = coreTagKeyCount;
while (j--) {
tagName = coreTagKeys[j]; tagName = coreTagKeys[j];
coreTags[tagName](tagName, node.attrs.hasOwnProperty(tagName), node.attrs, node, parentNode, pkg, i); coreTags[tagName](tagName, node.attrs.hasOwnProperty(tagName), node.attrs, node, parentNode, pkg, i);
} }
Expand All @@ -1582,9 +1583,13 @@
} }


// run post core tags for each node // run post core tags for each node
for (i = 0; i < nodeCount; i++) { i = nodeCount;
// order matters less on cleanup
while (i--) {
node = nodes[i]; node = nodes[i];
for (j = 0; j < corePostTagKeyCount; j++) { parentNode = nodes[node.parentIndex];
j = corePostTagKeyCount;
while (j--) {
tagName = corePostTagKeys[j]; tagName = corePostTagKeys[j];
corePostTags[tagName](tagName, node.attrs.hasOwnProperty(tagName), node.attrs, node, parentNode, pkg, i); corePostTags[tagName](tagName, node.attrs.hasOwnProperty(tagName), node.attrs, node, parentNode, pkg, i);
} }
Expand Down

0 comments on commit d5ef18c

Please sign in to comment.