-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
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
Add isPolyfilled
method
#193
Conversation
✅ Deploy Preview for popover-polyfill ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
src/popover.ts
Outdated
return ( | ||
document.body && | ||
document.body.showPopover && | ||
!document.body.showPopover.toString().match(/native code/i) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not particularly attached to this implementation, so if you have suggestions or think this code could/should be written in a different way, just let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM
@keithamus @jgerigmeyer I was looking at ways to do automatic testing of the function but from what I see with the current suite of tests it's not possible. Or am I missing something? |
Yeah we don't really have unit tests. Frankly I'm not especially concerned about tests for this amount of code. It'll get shaken out during integration. |
…estion Co-authored-by: Jonny Gerig Meyer <jonny@oddbird.net>
9df94fc
to
5ad1870
Compare
@jgerigmeyer there was a linting error that I was looking to fix but the PR is already merged. Has it been already fixed (automatically maybe)? Is it OK to leave it as it is? |
Yeah that's fine -- I merged it and then pushed a quick fix 👍 Thanks for your contribution! |
Description
This PR adds a
isPolyfilled
function to the public methods exposed by the polyfill.The functions tests if the Popover API has been polyfilled, and it can be used to execute conditional code depending on if the Popover API is polyfilled or is native.
Related Issue(s)
#189