Issue #2681Opened March 24, 2020by wemod1232 reactions

[BUG]: destroy() method didn't fully remove events

Question

version: latest: v-0.16.3.

important: update from v-0.15.9 to v-0.16.3 while keep everything same, the error will show in console:

Uncaught TypeError: Cannot read property 'frameElement' of null
    at r.getFrameOffset (grapes.min.js?a826:formatted:28973)
    at r.getElementPos (grapes.min.js?a826:formatted:28985)
    at r.getElementPos (grapes.min.js?a826:formatted:13792)
    at r.updateLocalPos (grapes.min.js?a826:formatted:13444)
    at r.onFrameUpdated (grapes.min.js?a826:formatted:13396)
    at I (grapes.min.js?a826:formatted:554)
    at eval (grapes.min.js?a826:formatted:566)
    at eval (grapes.min.js?a826:formatted:129)
    ....

This error show there is a errro in function getFrameOffset, near position: e.ownerDocument.defaultView.frameElement:

...
clearOff: function() {
   this.frmOff = null,
   this.cvsOff = null
},
getFrameOffset: function(e) {
   if (!this.frmOff || e) {
>>> var t = e ? e.ownerDocument.defaultView.frameElement : this.frame.el;
       this.frmOff = this.offset(t)
  }
  return this.frmOff
 },
getCanvasOffset: function() {
   return this.cvsOff || (this.cvsOff = this.offset(this.el)),
  this.cvsOff
}
...

Refer to This Code Line

Checking the error stack will track to This Code Line

Expected: no error reported. Impact: I do not get specific negitive impact, only show the error. Reproduce: I integrate with Vue usage + webpack, hard to really reproduce, to debug this probaly check:

  1. simply add check chain to avoid TypeError:
before: var t = e ? e.ownerDocument.defaultView.frameElement : this.frame.el;
after: var t= (e && e.ownerDocument && e.ownerDocument.defaultView &&  e.ownerDocument.defaultView.frameElement) || this.frame.el;
  1. if this frameElement is required, in what condition it will missing, and then cause error.

Answers (3)

emilsedghJanuary 6, 20221 reactions

I agree that this needs to be reopened and fixed within the destroy function itself.

emilsedghJanuary 31, 20221 reactions

Thank you @artf ! 🙏

artfApril 3, 20200 reactions

Thanks for the report @wemod123 Are you able to create a reproducible live demo of the issue?

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.