Skip to content

Commit 69b0569

Browse files
committed
avoid concurrent passiveHandler and poll
for a single scroll container
1 parent 4c787b2 commit 69b0569

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

addon/-private/data-view/utils/scroll-handler.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,23 @@ export class ScrollHandler {
3636
handlers
3737
};
3838
// TODO add explicit test
39-
if (SUPPORTS_PASSIVE) {
39+
if (this.isUsingPassive) {
4040
cache.passiveHandler = function() {
4141
ScrollHandler.triggerElementHandlers(element, cache);
4242
};
43+
44+
element.addEventListener('scroll', cache.passiveHandler, { capture: true, passive: true });
45+
// TODO add explicit test
4346
} else {
4447
cache.passiveHandler = UNDEFINED_VALUE;
48+
49+
this.poll();
4550
}
4651
} else {
4752
cache = this.handlers[index];
4853
handlers = cache.handlers;
4954
handlers.push(handler);
5055
}
51-
52-
// TODO add explicit test
53-
if (this.isUsingPassive && handlers.length === 1) {
54-
element.addEventListener('scroll', cache.passiveHandler, { capture: true, passive: true });
55-
56-
// TODO add explicit test
57-
} else if (!this.isPolling) {
58-
this.poll();
59-
}
6056
}
6157

6258
removeScrollHandler(element, handler) {

0 commit comments

Comments
 (0)