Skip to content

Commit c3dfff3

Browse files
committed
abandon Array.prototype.find
1 parent fbc7cb2 commit c3dfff3

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

dist/ui-scroll.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
22
* angular-ui-scroll
33
* https://github.com/angular-ui/ui-scroll.git
4-
* Version: 1.5.1 -- 2016-06-27T18:18:39.277Z
4+
* Version: 1.5.1 -- 2016-07-08T21:21:05.311Z
55
* License: MIT
66
*/
77

@@ -227,12 +227,11 @@ angular.module('ui.scroll', []).directive('uiScrollViewport', function () {
227227

228228
angular.extend(cache, {
229229
add: function add(item) {
230-
var existedItem = cache.find(function (i) {
231-
return i.index === item.scope.$index;
232-
});
233-
if (existedItem) {
234-
existedItem.height = item.element.outerHeight();
235-
return;
230+
for (var i = cache.length - 1; i >= 0; i--) {
231+
if (cache[i].index === item.scope.$index) {
232+
cache[i].height = item.element.outerHeight();
233+
return;
234+
}
236235
}
237236
cache.push({
238237
index: item.scope.$index,

0 commit comments

Comments
 (0)