Skip to content

Commit 6b53b70

Browse files
committed
fix: window focus handlers are never cleared which was causing repetitive calls on same element
1 parent 77419a0 commit 6b53b70

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/LiveDevelopment/MultiBrowserImpl/documents/LiveDocument.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ define(function (require, exports, module) {
7171

7272
// Redraw highlights when window gets focus. This ensures that the highlights
7373
// will be in sync with any DOM changes that may have occurred.
74-
$(window).focus(this._onHighlightPrefChange);
74+
$(window).on(`focus.LiveDocument-${this.doc.file.fullPath}`, this._onHighlightPrefChange);
7575

7676
if (editor) {
7777
// Attach now
@@ -91,6 +91,8 @@ define(function (require, exports, module) {
9191
EditorManager.off(`activeEditorChange.LiveDocument-${this.doc.file.fullPath}`);
9292
PreferencesManager.stateManager.getPreference("livedevHighlight")
9393
.off(`change.LiveDocument-${this.doc.file.fullPath}`);
94+
95+
$(window).off(`focus.LiveDocument-${this.doc.file.fullPath}`);
9496
};
9597

9698
/**

0 commit comments

Comments
 (0)