Skip to content

Commit f1b06ff

Browse files
committed
Merge pull request Polymer#988 from rickymarcon/master
Add onMutation to watch for children updates.
2 parents 78a0acb + 6fb0274 commit f1b06ff

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

0.5/elements/feature-carousel.html

+5-2
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,14 @@
2828
interval: null, // num milliseconds to cycle panels.
2929
selected: 0,
3030
domReady: function() {
31-
// TODO: use onMutation to watch for children updates.
31+
this.childrenUpdated();
32+
this.startCycler();
33+
},
34+
childrenUpdated: function(observer, mutations) {
3235
this.panels = Array.prototype.slice.call(
3336
this.$.content.getDistributedNodes());
3437

35-
this.startCycler();
38+
this.onMutation(this, this.childrenUpdated);
3639
},
3740
next: function(opt_Index, opt_backwards) {
3841
var backwards = opt_backwards == true;

0.8/elements/feature-carousel.html

+5-2
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,14 @@
2828
interval: null, // num milliseconds to cycle panels.
2929
selected: 0,
3030
domReady: function() {
31-
// TODO: use onMutation to watch for children updates.
31+
this.childrenUpdated();
32+
this.startCycler();
33+
},
34+
childrenUpdated: function(observer, mutations) {
3235
this.panels = Array.prototype.slice.call(
3336
this.$.content.getDistributedNodes());
3437

35-
this.startCycler();
38+
this.onMutation(this, this.childrenUpdated);
3639
},
3740
next: function(opt_Index, opt_backwards) {
3841
var backwards = opt_backwards == true;

0 commit comments

Comments
 (0)