Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

Commit 7d794af

Browse files
committed
slight refactoring; remove timeout since it's not needed anymore
1 parent 03b7178 commit 7d794af

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

polymer-collapse/polymer-collapse.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@
169169
this.target.classList.toggle('polymer-collapse-closed', add);
170170
},
171171
updateSize: function(size, duration, forceEnd) {
172+
if (duration) {
173+
this.calcSize();
174+
}
172175
this.setTransitionDuration(duration);
173176
var s = this.target.style;
174177
var nochange = s[this.dimension] === size;
@@ -188,6 +191,9 @@
188191
calcSize: function() {
189192
return this.target.getBoundingClientRect()[this.dimension] + 'px';
190193
},
194+
getComputedSize: function() {
195+
return getComputedStyle(this.target)[this.dimension];
196+
},
191197
show: function() {
192198
this.toggleClosedClass(false);
193199
// for initial update, skip the expanding animation to optimize
@@ -204,7 +210,7 @@
204210
}
205211
this.async(function() {
206212
this.updateSize(this.size || s, this.duration, true);
207-
}, null, 1);
213+
});
208214
},
209215
hide: function() {
210216
this.afterInitialUpdate = true;
@@ -214,13 +220,13 @@
214220
}
215221
if (this.fixedSize) {
216222
// save the size before hiding it
217-
this.size = getComputedStyle(this.target)[this.dimension];
223+
this.size = this.getComputedSize();
218224
} else {
219225
this.updateSize(this.calcSize(), null);
220226
}
221227
this.async(function() {
222228
this.updateSize(0, this.duration);
223-
}, null, 1);
229+
});
224230
}
225231
});
226232
</script>

0 commit comments

Comments
 (0)