Commit 1d15cbbced144678b056c98c0e433e6a03fa19f0
Committed by
GitHub
Merge pull request #2407 from SergioCrisostomo/fix-look-for-parent
don't check past document.body when moving up DOM tree
Showing
1 changed file
with
7 additions
and
7 deletions
Show diff stats
src/components/tabs/tabs.vue
... | ... | @@ -239,8 +239,8 @@ |
239 | 239 | if (!currentOffset) return; |
240 | 240 | |
241 | 241 | let newOffset = currentOffset > containerWidth |
242 | - ? currentOffset - containerWidth | |
243 | - : 0; | |
242 | + ? currentOffset - containerWidth | |
243 | + : 0; | |
244 | 244 | |
245 | 245 | this.setOffset(newOffset); |
246 | 246 | }, |
... | ... | @@ -251,16 +251,16 @@ |
251 | 251 | if (navWidth - currentOffset <= containerWidth) return; |
252 | 252 | |
253 | 253 | let newOffset = navWidth - currentOffset > containerWidth * 2 |
254 | - ? currentOffset + containerWidth | |
255 | - : (navWidth - containerWidth); | |
254 | + ? currentOffset + containerWidth | |
255 | + : (navWidth - containerWidth); | |
256 | 256 | |
257 | 257 | this.setOffset(newOffset); |
258 | 258 | }, |
259 | 259 | getCurrentScrollOffset() { |
260 | 260 | const { navStyle } = this; |
261 | 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 | 265 | setOffset(value) { |
266 | 266 | this.navStyle.transform = `translateX(-${value}px)`; |
... | ... | @@ -313,7 +313,7 @@ |
313 | 313 | }, |
314 | 314 | isInsideHiddenElement () { |
315 | 315 | let parentNode = this.$el.parentNode; |
316 | - while(parentNode) { | |
316 | + while(parentNode && parentNode !== document.body) { | |
317 | 317 | if (parentNode.style.display === 'none') { |
318 | 318 | return parentNode; |
319 | 319 | } | ... | ... |