Skip to content

Commit 84375b0

Browse files
authored
perf: remove add/remove event polyfills\n\nWe don't polyfill these browsers using core-js (i.e. it most likely doesn't work anyway) and barely anyone is using them nowadays. (#1025)
1 parent 4e63164 commit 84375b0

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

lib/graph3d/Graph3d.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -526,11 +526,11 @@ Graph3d.prototype.create = function () {
526526
};
527527
// TODO: these events are never cleaned up... can give a 'memory leakage'
528528

529-
util.addEventListener(this.frame.canvas, "mousedown", onmousedown);
530-
util.addEventListener(this.frame.canvas, "touchstart", ontouchstart);
531-
util.addEventListener(this.frame.canvas, "mousewheel", onmousewheel);
532-
util.addEventListener(this.frame.canvas, "mousemove", ontooltip);
533-
util.addEventListener(this.frame.canvas, "click", onclick);
529+
this.frame.canvas.addEventListener("mousedown", onmousedown);
530+
this.frame.canvas.addEventListener("touchstart", ontouchstart);
531+
this.frame.canvas.addEventListener("mousewheel", onmousewheel);
532+
this.frame.canvas.addEventListener("mousemove", ontooltip);
533+
this.frame.canvas.addEventListener("click", onclick);
534534

535535
// add the new graph to the container element
536536
this.containerElement.appendChild(this.frame);
@@ -2079,8 +2079,8 @@ Graph3d.prototype._onMouseDown = function (event) {
20792079
this.onmouseup = function (event) {
20802080
me._onMouseUp(event);
20812081
};
2082-
util.addEventListener(document, "mousemove", me.onmousemove);
2083-
util.addEventListener(document, "mouseup", me.onmouseup);
2082+
document.addEventListener("mousemove", me.onmousemove);
2083+
document.addEventListener("mouseup", me.onmouseup);
20842084
util.preventDefault(event);
20852085
};
20862086

@@ -2253,8 +2253,8 @@ Graph3d.prototype._onTouchStart = function (event) {
22532253
this.ontouchend = function (event) {
22542254
me._onTouchEnd(event);
22552255
};
2256-
util.addEventListener(document, "touchmove", me.ontouchmove);
2257-
util.addEventListener(document, "touchend", me.ontouchend);
2256+
document.addEventListener("touchmove", me.ontouchmove);
2257+
document.addEventListener("touchend", me.ontouchend);
22582258

22592259
this._onMouseDown(event);
22602260
};

lib/graph3d/Slider.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,8 @@ Slider.prototype._onMouseDown = function (event) {
310310
this.onmouseup = function (event) {
311311
me._onMouseUp(event);
312312
};
313-
util.addEventListener(document, "mousemove", this.onmousemove);
314-
util.addEventListener(document, "mouseup", this.onmouseup);
313+
document.addEventListener("mousemove", this.onmousemove);
314+
document.addEventListener("mouseup", this.onmouseup);
315315
util.preventDefault(event);
316316
};
317317

0 commit comments

Comments
 (0)