Skip to content

Commit 652283e

Browse files
authored
Simplify logic in the getScrollParent function
1 parent fb1667e commit 652283e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/components/InfiniteLoading.vue

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,16 +270,14 @@
270270
getScrollParent(elm = this.$el) {
271271
let result;
272272
273-
if (!this.forceUseInfiniteWrapper && ['scroll', 'auto'].indexOf(getComputedStyle(elm).overflowY) > -1) {
273+
if (elm.tagName === 'BODY') {
274+
result = window;
275+
} else if (!this.forceUseInfiniteWrapper && ['scroll', 'auto'].indexOf(getComputedStyle(elm).overflowY) > -1) {
274276
result = elm;
275277
} else if (elm.hasAttribute('infinite-wrapper') || elm.hasAttribute('data-infinite-wrapper')) {
276278
result = elm;
277279
}
278280
279-
if (elm.tagName === 'BODY') {
280-
result = window;
281-
}
282-
283281
return result || this.getScrollParent(elm.parentNode);
284282
},
285283
},

0 commit comments

Comments
 (0)