display: none causing errors
See original GitHub issueif i use this mixin in a component, and then put something like print_hidden
from tailwindcss above or on that component, i get the following error:
TypeError: Failed to construct 'IntersectionObserver': The provided double value is non-finite.
at VueComponent.addInViewportHandlers (index.js:526)
at VueComponent.inViewportInit (index.js:514)
at VueComponent.reInitInViewportMixin (index.js:509)
at VueComponent.inViewportThresholdWithMax (index.js:500)
at Watcher.run (commons.app.js:14062)
at flushSchedulerQueue (commons.app.js:13804)
at Array.<anonymous> (commons.app.js:11485)
at flushCallbacks (commons.app.js:11411)
the line that triggers it:
this.inViewportObserver = new IntersectionObserver(this.updateInViewport, {
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:6 (1 by maintainers)
Top Results From Across the Web
html - CSS - display: none; not working - Stack Overflow
CSS - display: none; not working · 1. is that in a media query? Have you tried using a more specific selector or...
Read more >CSS 'display: none' causes problems for screenreaders
The issue is that using CSS 'display:none', will actually hide the content contained in the <div> that the declaration is attached to from...
Read more >display NONE not working - possible conflict on stylesheet?
I see NO syntax or other quirky errors, and i have now read thru every line 5 times. my editor picks up no...
Read more >display - CSS: Cascading Style Sheets - MDN Web Docs
Using a display value of none on an element will remove it from the accessibility tree. This will cause the element and all...
Read more >125 (Nested in display:none gives width()/height()=0) – jQuery
If #outer is display:block then #inner returns width()==10. It looks like (in IE6/FF at least) any display:none parent causes width()/height() to return 0....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the suggestion @can-keklik, I released a fix as 2.0.2
It probably just needs an isFinite check. I’m not very familiar with CoffeeScript, so will try to demonstrate it on js:
https://github.com/BKWLD/vue-in-viewport-mixin/blob/74819bc85eccf1036294656f3c089159fe11c48f/index.js#L198
In some cases, the expression evaluates to NaN or Infinity.
For instance:
Math.min(1, 0/0)
So that division should be checked like this:
It worked for me, but you should do your own experiments of course.