Preparation Code Preparation HTML (this will be inserted in the <body>
of a valid HTML5 document in standards mode) (useful when testing DOM operations or including libraries) <script src ="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" >
</script >
<script src ="http://cdn.sencha.io/ext-4.1.0-gpl/ext-all.js" >
</script >
<script src ="https://raw.github.com/bestiejs/lodash/v0.8.2/lodash.min.js" > </script >
<script > var lodash = _.noConflict (); </script >
<script src ="https://raw.github.com/documentcloud/underscore/master/underscore.js" >
</script >
<script >
$.fn.forEach = Array .prototype .forEach ;
var extArrayEach = Ext .Array .each ;
Array .prototype .each = function (func ){
var array = this ,
i = 0 ,
l = array.length ;
while (i < l) func (array[i], i, array), i++;
return array
};
var breaker = {};
_.forEach = function (obj, iterator, context ) {
if (obj == null ) return ;
if (obj.length === +obj.length ) {
for (var i = 0 , l = obj.length ; i < l; i++) {
if (iterator.call (context, obj[i], i, obj) === breaker) return ;
}
} else {
for (var key in obj) {
if (_.has (obj, key)) {
if (iterator.call (context, obj[key], key, obj) === breaker) return ;
}
}
}
};
var a = [];
for (var i = 0 , len = 100 ; i < len; i++) {
a[i] = i;
}
</script >
Setup JS
Teardown JS
Test cases
Test #1 Title *
Async
Code * $.each (a, function (index, node ) {
var e = node;
});
Test #2 Title *
Async
Code * for (var i = 0 , len = a.length ; i < len; i++) {
var e = a[i];
};
Title *
Async
Code * a.forEach (function (node, index ){
var e = node;
});
Title *
Async
Code * extArrayEach (a, function (index, node ) {
var e = node;
});
Title *
Async
Code * a.each (function (node ){
var e = node;
})
Title *
Async
Code * _.each (a, function (node, index ){
var e = node;
})
Title *
Async
Code * _.forEach (a, function (node, index ){
var e = node;
})
Title *
Async
Code * lodash.forEach (a, function (node, index ){
var e = node;
});