We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I've just found one line in the source code that made me confused
https://github.com/ghosh/Micromodal/blob/master/lib/src/index.js#L106
const body = document.querySelector('body')
Why would you use querySelector to find the body element? There's document.body to do this - shorter, faster, full support
document.body
The text was updated successfully, but these errors were encountered:
Ok, I don't like that function at all. Too complicated to do so simple thing. I would write so (
/** @param {'enable'|'disable'} value */ scrollBehaviour(value) { if (!this.config.disableScroll) return if (value === 'enable') { document.body.style.overflow = ''; } else if (value === 'disable') { document.body.style.overflow = 'hidden'; } } Or: /** @param {'enable'|'disable'} value */ scrollBehaviour(value) { if (!this.config.disableScroll) return const overflow = (value === 'disable') ? 'hidden' : ''; document.body.style.overflow = overflow; } Or: /** @param {boolean} value */ function toggleScrolling(value) { if (!this.config.disableScroll) return document.body.style.overflow = (!value) ? 'hidden' : ''; }
Sorry, something went wrong.
No branches or pull requests
I've just found one line in the source code that made me confused
https://github.com/ghosh/Micromodal/blob/master/lib/src/index.js#L106
Why would you use querySelector to find the body element?
There's
document.body
to do this - shorter, faster, full supportThe text was updated successfully, but these errors were encountered: