Skip to content

Commit dd8bf2b

Browse files
committed
Backport PR #1985: Ignore resize events that bubbled up and didn't come from window.
See https://bugs.jquery.com/ticket/9841 - we were having a major slowdown in interact widgets because the output areas were triggering a 'resize' event, which was bubbling up to the window object and running a function which required a DOM read. Signed-off-by: Min RK <[email protected]>
1 parent 6ada253 commit dd8bf2b

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

notebook/static/base/js/page.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,19 @@ define([
5353
this._resize_site();
5454
};
5555

56-
Page.prototype._resize_site = function() {
57-
// Update the site's size.
58-
$('div#site').height($(window).height() - $('#header').height());
56+
57+
58+
Page.prototype._resize_site = function(e) {
59+
/**
60+
* Update the site's size.
61+
*/
62+
63+
// In the case an event is passed in, only trigger if the event does
64+
// *not* have a target DOM node (i.e., it is not bubbling up). See
65+
// https://bugs.jquery.com/ticket/9841#comment:8
66+
if (!(e && e.target && e.target.tagName)) {
67+
$('div#site').height($(window).height() - $('#header').height());
68+
}
5969
};
6070

6171
return {'Page': Page};

0 commit comments

Comments
 (0)