Commit 1d15cbbced144678b056c98c0e433e6a03fa19f0

Authored by Aresn
Committed by GitHub
2 parents 240bb212 a74be22e

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,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 }