Commit a74be22ea8d475a4fbf0aa35e38de74934dbd198
1 parent
240bb212
don't check DOM tree past document.body
Showing
1 changed file
with
7 additions
and
7 deletions
Show diff stats
src/components/tabs/tabs.vue
@@ -239,8 +239,8 @@ | @@ -239,8 +239,8 @@ | ||
239 | if (!currentOffset) return; | 239 | if (!currentOffset) return; |
240 | 240 | ||
241 | let newOffset = currentOffset > containerWidth | 241 | let newOffset = currentOffset > containerWidth |
242 | - ? currentOffset - containerWidth | ||
243 | - : 0; | 242 | + ? currentOffset - containerWidth |
243 | + : 0; | ||
244 | 244 | ||
245 | this.setOffset(newOffset); | 245 | this.setOffset(newOffset); |
246 | }, | 246 | }, |
@@ -251,16 +251,16 @@ | @@ -251,16 +251,16 @@ | ||
251 | if (navWidth - currentOffset <= containerWidth) return; | 251 | if (navWidth - currentOffset <= containerWidth) return; |
252 | 252 | ||
253 | let newOffset = navWidth - currentOffset > containerWidth * 2 | 253 | let newOffset = navWidth - currentOffset > containerWidth * 2 |
254 | - ? currentOffset + containerWidth | ||
255 | - : (navWidth - containerWidth); | 254 | + ? currentOffset + containerWidth |
255 | + : (navWidth - containerWidth); | ||
256 | 256 | ||
257 | this.setOffset(newOffset); | 257 | this.setOffset(newOffset); |
258 | }, | 258 | }, |
259 | getCurrentScrollOffset() { | 259 | getCurrentScrollOffset() { |
260 | const { navStyle } = this; | 260 | const { navStyle } = this; |
261 | return navStyle.transform | 261 | return navStyle.transform |
262 | - ? Number(navStyle.transform.match(/translateX\(-(\d+(\.\d+)*)px\)/)[1]) | ||
263 | - : 0; | 262 | + ? Number(navStyle.transform.match(/translateX\(-(\d+(\.\d+)*)px\)/)[1]) |
263 | + : 0; | ||
264 | }, | 264 | }, |
265 | setOffset(value) { | 265 | setOffset(value) { |
266 | this.navStyle.transform = `translateX(-${value}px)`; | 266 | this.navStyle.transform = `translateX(-${value}px)`; |
@@ -313,7 +313,7 @@ | @@ -313,7 +313,7 @@ | ||
313 | }, | 313 | }, |
314 | isInsideHiddenElement () { | 314 | isInsideHiddenElement () { |
315 | let parentNode = this.$el.parentNode; | 315 | let parentNode = this.$el.parentNode; |
316 | - while(parentNode) { | 316 | + while(parentNode && parentNode !== document.body) { |
317 | if (parentNode.style.display === 'none') { | 317 | if (parentNode.style.display === 'none') { |
318 | return parentNode; | 318 | return parentNode; |
319 | } | 319 | } |