|
3 | 3 | */ |
4 | 4 |
|
5 | 5 | import Base from "../../core/base"; |
| 6 | +import dom from "../../core/dom"; |
6 | 7 | import logging from "../../core/logging"; |
7 | 8 | import Parser from "../../core/parser"; |
8 | 9 | import utils from "../../core/utils"; |
@@ -42,8 +43,8 @@ export default Base.extend({ |
42 | 43 | }, |
43 | 44 |
|
44 | 45 | _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"); |
47 | 48 |
|
48 | 49 | const pos = { |
49 | 50 | top: dom.get_css_value(this.el, "top", true), |
@@ -135,25 +136,4 @@ export default Base.extend({ |
135 | 136 | } |
136 | 137 | } |
137 | 138 | }, |
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 | | - }, |
159 | 139 | }); |
0 commit comments