Skip to content

Commit 5f7d0fa

Browse files
committed
feat(QResizeObservable): Guard onResize handler
1 parent 3e7eb3d commit 5f7d0fa

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/components/observables/QResizeObservable.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@ export default {
1010
},
1111
methods: {
1212
onResize () {
13-
const size = {
14-
width: this.parent.offsetWidth,
15-
height: this.parent.offsetHeight
13+
if (!this.$el || !this.$el.parentNode) {
14+
return
1615
}
1716

17+
const
18+
parent = this.$el.parentNode,
19+
size = {
20+
width: parent.offsetWidth,
21+
height: parent.offsetHeight
22+
}
23+
1824
if (size.width === this.size.width && size.height === this.size.height) {
1925
return
2026
}
@@ -54,7 +60,6 @@ export default {
5460
this.url = ie ? null : 'about:blank'
5561
},
5662
mounted () {
57-
this.parent = this.$el.parentNode
5863
this.size = { width: -1, height: -1 }
5964
this.trigger()
6065

0 commit comments

Comments
 (0)