Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2388)

Unified Diff: ui/webui/resources/cr_elements/cr_scrollable_behavior.js

Issue 2522783003: MD Settings: Fix CrScrollableBehavior (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/webui/resources/cr_elements/cr_scrollable_behavior.js
diff --git a/ui/webui/resources/cr_elements/cr_scrollable_behavior.js b/ui/webui/resources/cr_elements/cr_scrollable_behavior.js
index 59e1e53dab1b3e5885ebf1fc432df3a1ffc67b28..ec362f8fb0c1caa1034c048303ef9de5b1774252 100644
--- a/ui/webui/resources/cr_elements/cr_scrollable_behavior.js
+++ b/ui/webui/resources/cr_elements/cr_scrollable_behavior.js
@@ -56,7 +56,7 @@ var CrScrollableBehavior = {
},
detached: function() {
- if (this.intervalId_)
+ if (this.intervalId_ !== undefined)
clearInterval(this.intervalId_);
},
@@ -68,7 +68,9 @@ var CrScrollableBehavior = {
updateScrollableContents() {
let nodeList = this.root.querySelectorAll('[scrollable] iron-list');
// Use setTimeout to avoid initial render / sizing issues.
- this.intervalId_ = setInterval(function() {
+ if (this.intervalId_ === undefined)
dpapad 2016/11/23 01:12:51 Shouldn't this be the opposite? if (this.interval
stevenjb 2016/11/23 18:07:01 Er, ugh, yes. I must already be in vacation mode.
+ return;
+ this.intervalId_ = window.setInterval(function() {
let unreadyNodes = [];
for (let node of nodeList) {
if (node.parentNode.scrollHeight == 0) {
@@ -78,10 +80,12 @@ var CrScrollableBehavior = {
let ironList = /** @type {!IronListElement} */ (node);
ironList.notifyResize();
}
- if (unreadyNodes.length == 0)
- clearInterval(this.intervalId_);
- else
+ if (unreadyNodes.length == 0) {
+ window.clearInterval(this.intervalId_);
+ this.intervalId_ = undefined;
dpapad 2016/11/23 01:12:51 Setting something to |undefined| is counter intuit
stevenjb 2016/11/23 18:07:01 It seems odd to me to set a Number to null, but I
+ } else {
nodeList = unreadyNodes;
+ }
}.bind(this), 10);
},
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698