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

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

Issue 2477693005: MD Settings: Close edit startup URL dialog, if underlying URL list changes. (Closed)
Patch Set: Add missing dependency to iron-list.html 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 | « chrome/test/data/webui/settings/startup_urls_page_test.js ('k') | 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 362753f91b74638a2ba647db2f6d5f85844200c7..59e1e53dab1b3e5885ebf1fc432df3a1ffc67b28 100644
--- a/ui/webui/resources/cr_elements/cr_scrollable_behavior.js
+++ b/ui/webui/resources/cr_elements/cr_scrollable_behavior.js
@@ -36,6 +36,11 @@
/** @polymerBehavior */
var CrScrollableBehavior = {
+ properties: {
+ /** @private */
+ intervalId_: Number,
+ },
+
ready: function() {
var scrollableElements = this.root.querySelectorAll('[scrollable]');
@@ -50,6 +55,11 @@ var CrScrollableBehavior = {
scrollable.addEventListener('scroll', this.updateScrollEvent_.bind(this));
},
+ detached: function() {
+ if (this.intervalId_)
+ clearInterval(this.intervalId_);
+ },
+
/**
* Called any time the contents of a scrollable container may have changed.
* This ensures that the <iron-list> contents of dynamically sized
@@ -58,7 +68,7 @@ var CrScrollableBehavior = {
updateScrollableContents() {
let nodeList = this.root.querySelectorAll('[scrollable] iron-list');
// Use setTimeout to avoid initial render / sizing issues.
- let intervalId = setInterval(function() {
+ this.intervalId_ = setInterval(function() {
let unreadyNodes = [];
for (let node of nodeList) {
if (node.parentNode.scrollHeight == 0) {
@@ -69,10 +79,10 @@ var CrScrollableBehavior = {
ironList.notifyResize();
}
if (unreadyNodes.length == 0)
- clearInterval(intervalId);
+ clearInterval(this.intervalId_);
else
nodeList = unreadyNodes;
- }, 10);
+ }.bind(this), 10);
},
/**
« no previous file with comments | « chrome/test/data/webui/settings/startup_urls_page_test.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698