Skip to content

Commit

Permalink
Change how elements are removed on destroying
Browse files Browse the repository at this point in the history
When the plugin destroy() method was called, I got an error because removeChild was called with something that wasn't a Node, for this.showTime and this.cursor. 
It seems that these members are Proxy objects, and the removeChild doesn't swallow that. Changing from removeChild to remove() on the Proxy objects seems to fix this.
  • Loading branch information
JanMisker committed Feb 27, 2022
1 parent 46d423b commit 29afe0a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/plugin/cursor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ export default class CursorPlugin {
*/
destroy() {
if (this.params.showTime) {
this.cursor.parentNode.removeChild(this.showTime);
this.showTime.remove();
}
this.cursor.parentNode.removeChild(this.cursor);
this.cursor.remove();
this.wrapper.removeEventListener('mousemove', this._onMousemove);
if (this.params.hideOnBlur) {
this.wrapper.removeEventListener('mouseenter', this._onMouseenter);
Expand Down

0 comments on commit 29afe0a

Please sign in to comment.