Skip to content

Conversation

@udayanshevade
Copy link

@udayanshevade udayanshevade commented Sep 2, 2020

Regarding #161: Adding a couple of quick checks wherever the original scroll functions are called to ensure properties on arguments[0] aren't accessed if its value is null, after shouldBailOut(arguments[0]) evaluates to true.

arguments[0] !== null && arguments[0].left !== undefined
? arguments[0].left
: typeof arguments[0] !== 'object'
: arguments[0] === null || typeof arguments[0] !== 'object'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update: Checking against null and allowing it to be passed through to the original scroll function. If this isn't desirable I can revert it.

arguments[0].left !== undefined
arguments[0] !== null && arguments[0].left !== undefined
? arguments[0].left
: typeof arguments[0] !== 'object'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that the browser implementation of window.scrollTo handles null, whereas this ternary excludes null and passes a default of scrollX or pageXOffset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant