Skip to content

Commit ab98985

Browse files
committed
maint(pat bumper): Use new core.dom.find_scroll_container instead own implementation.
1 parent d9eef9e commit ab98985

File tree

1 file changed

+3
-23
lines changed

1 file changed

+3
-23
lines changed

src/pat/bumper/bumper.js

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*/
44

55
import Base from "../../core/base";
6+
import dom from "../../core/dom";
67
import logging from "../../core/logging";
78
import Parser from "../../core/parser";
89
import utils from "../../core/utils";
@@ -42,8 +43,8 @@ export default Base.extend({
4243
},
4344

4445
_init() {
45-
const scroll_container_y = this.findScrollContainer("y");
46-
const scroll_container_x = this.findScrollContainer("x");
46+
const scroll_container_y = dom.find_scroll_container(this.el.parentElement, "y");
47+
const scroll_container_x = dom.find_scroll_container(this.el.parentElement, "x");
4748

4849
const pos = {
4950
top: dom.get_css_value(this.el, "top", true),
@@ -135,25 +136,4 @@ export default Base.extend({
135136
}
136137
}
137138
},
138-
139-
findScrollContainer(direction = null) {
140-
let parent = this.el.parentElement;
141-
let overflow;
142-
while (parent && parent !== document.body) {
143-
if (!direction || direction === "y") {
144-
overflow = utils.getCSSValue(parent, "overflow-y");
145-
if (overflow === "auto" || overflow === "scroll") {
146-
return parent;
147-
}
148-
}
149-
if (!direction || direction === "x") {
150-
overflow = utils.getCSSValue(parent, "overflow-x");
151-
if (overflow === "auto" || overflow === "scroll") {
152-
return parent;
153-
}
154-
}
155-
parent = parent.parentElement;
156-
}
157-
return null;
158-
},
159139
});

0 commit comments

Comments
 (0)