Browse files

Using for loop instead of .forEach in `_data` setup

[skip ci]
  • Loading branch information...
1 parent f800940 commit 3605068eba49493940d1f021a89e27ce6f66f44c @bemson committed Feb 19, 2014
Showing with 13 additions and 6 deletions.
  1. +13 −6 src/salt.js
View
19 src/salt.js
@@ -252,18 +252,25 @@
_data: function (tagName, exists, tags, node) {
var
cfgs = {},
+ dataAry,
+ dataIdx = 0,
+ dataLn,
+ data,
+ typeofData,
key
;
// init dtos property to collect data tracking objects
node.dcfgs = [];
if (exists) {
- (isArray(tags._data) ? tags._data : [tags._data]).forEach(function (data) {
- var
- typeofData = typeof data,
- key
- ;
+ dataAry = isArray(tags._data) ? tags._data : [tags._data];
+ dataLn = dataAry.length;
+ for (; dataIdx < dataLn; dataIdx++) {
+
+ data = dataAry[dataIdx];
+ typeofData = typeof data;
+
if (typeofData === 'string' && data) {
cfgs[data] = {
use: 0,
@@ -282,7 +289,7 @@
}
}
}
- });
+ }
for (key in cfgs) {
if (cfgs.hasOwnProperty(key)) {
node.dcfgs.push(cfgs[key]);

0 comments on commit 3605068

Please sign in to comment.