Skip to content

Commit

Permalink
Improve type safety of scroll method
Browse files Browse the repository at this point in the history
Makes closure compiler happy.
  • Loading branch information
rictic authored Apr 13, 2018
1 parent c36cc42 commit a570eb2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions iron-scroll-target-behavior.html
Original file line number Diff line number Diff line change
Expand Up @@ -190,18 +190,22 @@
* Scrolls the content to a particular place.
*
* @method scroll
* @param {number|!ScrollToOptions} leftOrOptions The left position or scroll options
* @param {number|!{left: number, top: number}} leftOrOptions The left position or scroll options
* @param {number=} top The top position
* @return {void}
*/
scroll: function(leftOrOptions, top) {
var left = leftOrOptions;
var left;

if (typeof leftOrOptions === 'object') {
left = leftOrOptions.left;
top = leftOrOptions.top;
} else {
left = leftOrOptions;
}

left = left || 0;
top = top || 0;
if (this.scrollTarget === this._doc) {
window.scrollTo(left, top);
} else if (this._isValidScrollTarget()) {
Expand Down

0 comments on commit a570eb2

Please sign in to comment.