-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat(b-img-lazy): switch IntersectionObserver to use private v-b-visible directive
#3977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #3977 +/- ##
==========================================
- Coverage 99.86% 99.86% -0.01%
==========================================
Files 238 238
Lines 4466 4442 -24
Branches 1254 1248 -6
==========================================
- Hits 4460 4436 -24
Misses 5 5
Partials 1 1
Continue to review full report at Codecov.
|
|
@tmorehouse Yeah, I'am for the removing of the fallback code. |
|
@jackmu95 should we make it so that if IntersectionObserver is not found, then always show the image? |
|
@tmorehouse Yeah. And adding a warning maybe to include a polyfill. |
v-b-visible directivev-b-visible directive
|
It appears that Vue-test-utils doesn't unbind a directive if the directive is conditionally removed from the element. It only calls unbind if the node is destroyed. Although Vue itself does properly unbind a directive if it is removed from the render. |
Describe the PR
Rather than using
IntersectionObserverdirectly, switch to the privatev-b-visibledirectiveIf we assume the user has added a polyfill for
IntersectionObserverwe can further reduce the size of the code by removing all the fallback window scroll/transition listeners.If
IntersectionObserveris not found, we just always force show the image (always non-lazy)To Do:
PR checklist
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
If
IntersectionObserversupport is not found (either natively or via polyfill), then the image will always be shown (non-lazy, and regardless of the show prop state)The PR fulfills these requirements:
devbranch, not themasterbranch[...] (fixes #xxx[,#xxx]), where "xxx" is the issue number)fix(alert): not alerting during SSR render,docs(badge): update pill examples, fix typos,chore: fix typo in README, etc). This is very important, as theCHANGELOGis generated from these messages.If new features/enhancement/fixes are added or changed:
package.jsonfor slot and event changes)If adding a new feature, or changing the functionality of an existing feature, the PR's
description above includes: