Skip to content
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

Use bundled scripts for polyfills #88

Open
swissspidy opened this issue Dec 5, 2018 · 0 comments
Open

Use bundled scripts for polyfills #88

swissspidy opened this issue Dec 5, 2018 · 0 comments

Comments

@swissspidy
Copy link
Contributor

In WordPress 5.0 we now have wp_get_script_polyfill() and the wp-polyfill script handle.

wp_default_packages_vendor() does register some polyfills by default when enqueuing wp-polyfill: wp-polyfill-fetch, wp-polyfill-node-contains, wp-polyfill-formdata, wp-polyfill-element-closest. wp-polyfill itself contains polyfills for things like Promises.

In this plugin, we manually add polyfills for #Element.closest and window.fetch, as well as Promises.

To make things easier for us, it would make sense to use the polyfills provided by WordPress for this. Makes maintenance a bit easier again. For WordPress < 5.0 we could still use the current approach.

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

No branches or pull requests

1 participant