BigW Consortium Gitlab

Commit 7c29f03e by Mike Greiling

ensure click event is bound only once

parent 1cc6d206
......@@ -2,6 +2,7 @@
(() => {
const UNFOLD_COUNT = 20;
let isBound = false;
class Diff {
constructor() {
......@@ -15,10 +16,12 @@
$('.content-wrapper .container-fluid').removeClass('container-limited');
}
$(document)
.off('click', '.js-unfold, .diff-line-num a')
.on('click', '.js-unfold', this.handleClickUnfold.bind(this))
.on('click', '.diff-line-num a', this.handleClickLineNum.bind(this));
if (!isBound) {
$(document)
.on('click', '.js-unfold', this.handleClickUnfold.bind(this))
.on('click', '.diff-line-num a', this.handleClickLineNum.bind(this));
isBound = true;
}
this.openAnchoredDiff();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment