8000 fix(b-img-lazy): `blank` placeholder for Firefox · bootstrap-vue/bootstrap-vue@ad9c7e0 · GitHub
[go: up one dir, main page]

Skip to content

Commit ad9c7e0

Browse files
committed
fix(b-img-lazy): blank placeholder for Firefox
1 parent 98df499 commit ad9c7e0

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/components/image/img-lazy.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ const imgProps = omit(BImgProps, ['blank'])
2323
export const props = makePropsConfigurable(
2424
{
2525
...imgProps,
26-
blankColor: makeProp(PROP_TYPE_STRING, 'transparent'),
2726
blankHeight: makeProp(PROP_TYPE_NUMBER_STRING),
2827
// If `null`, a blank image is generated
2928
blankSrc: makeProp(PROP_TYPE_STRING, null),
@@ -71,14 +70,14 @@ export const BImgLazy = /*#__PURE__*/ Vue.extend({
7170
.filter(identity)
7271
.join(',')
7372

74-
return !this.blankSrc || this.isShown ? srcset : null
73+
return srcset && (!this.blankSrc || this.isShown) ? srcset : null
7574
},
7675
computedSizes() {
7776
const sizes = concat(this.sizes)
7877
.filter(identity)
7978
.join(',')
8079

81-
return !this.blankSrc || this.isShown ? sizes : null
80+
return sizes && (!this.blankSrc || this.isShown) ? sizes : null
8281
}
8382
},
8483
watch: {
@@ -90,7 +89,7 @@ export const BImgLazy = /*#__PURE__*/ Vue.extend({
9089
this.isShown = visible
9190

9291
// Ensure the show prop is synced (when no `IntersectionObserver`)
93-
if (visible !== newValue) {
92+
if (newValue !== visible) {
9493
this.$nextTick(this.updateShowProp)
9594
}
9695
}
@@ -124,7 +123,7 @@ export const BImgLazy = /*#__PURE__*/ Vue.extend({
124123
// We only add the visible directive if we are not shown
125124
directives.push({
126125
// Visible directive will silently do nothing if
127-
// IntersectionObserver is not supported
126+
// `IntersectionObserver` is not supported
128127
name: 'b-visible',
129128
// Value expects a callback (passed one arg of `visible` = `true` or `false`)
130129
value: this.doShow,
@@ -147,8 +146,8 @@ export const BImgLazy = /*#__PURE__*/ Vue.extend({
147146
blank: this.computedBlank,
148147
width: this.computedWidth,
149148
height: this.computedHeight,
150-
srcset: this.computedSrcset || null,
151-
sizes: this.computedSizes || null
149+
srcset: this.computedSrcset,
150+
sizes: this.computedSizes
152151
}
153152
})
154153
}

0 commit comments

Comments
 (0)
0