Skip to content

Commit a570eb2

Browse files
authored
Improve type safety of scroll method
Makes closure compiler happy.
1 parent c36cc42 commit a570eb2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

iron-scroll-target-behavior.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,18 +190,22 @@
190190
* Scrolls the content to a particular place.
191191
*
192192
* @method scroll
193-
* @param {number|!ScrollToOptions} leftOrOptions The left position or scroll options
193+
* @param {number|!{left: number, top: number}} leftOrOptions The left position or scroll options
194194
* @param {number=} top The top position
195195
* @return {void}
196196
*/
197197
scroll: function(leftOrOptions, top) {
198-
var left = leftOrOptions;
198+
var left;
199199

200200
if (typeof leftOrOptions === 'object') {
201201
left = leftOrOptions.left;
202202
top = leftOrOptions.top;
203+
} else {
204+
left = leftOrOptions;
203205
}
204206

207+
left = left || 0;
208+
top = top || 0;
205209
if (this.scrollTarget === this._doc) {
206210
window.scrollTo(left, top);
207211
} else if (this._isValidScrollTarget()) {

0 commit comments

Comments
 (0)