From 613b793ee17a2dc2cbdba67f166be121a35c2189 Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Tue, 29 Jan 2019 12:05:14 -0500 Subject: [PATCH] Plugin: Deprecate gutenberg_get_script_polyfill (#13536) --- .../backward-compatibility/deprecations.md | 1 + lib/client-assets.php | 28 +++------- phpunit/class-polyfill-test.php | 54 ------------------- 3 files changed, 8 insertions(+), 75 deletions(-) delete mode 100644 phpunit/class-polyfill-test.php diff --git a/docs/designers-developers/developers/backward-compatibility/deprecations.md b/docs/designers-developers/developers/backward-compatibility/deprecations.md index 81cd5352a2cfea..6ff124b27a34fa 100644 --- a/docs/designers-developers/developers/backward-compatibility/deprecations.md +++ b/docs/designers-developers/developers/backward-compatibility/deprecations.md @@ -57,6 +57,7 @@ The Gutenberg project's deprecation policy is intended to support backward compa - The PHP function `gutenberg_toggle_custom_fields` has been removed. - The PHP function `gutenberg_collect_meta_box_data` has been removed. Use [`register_and_do_post_meta_boxes`](https://developer.wordpress.org/reference/functions/register_and_do_post_meta_boxes/) instead. - `window._wpLoadGutenbergEditor` has been removed. Use `window._wpLoadBlockEditor` instead. Note: This is a private API, not intended for public use. It may be removed in the future. +- The PHP function `gutenberg_get_script_polyfill` has been removed. Use [`wp_get_script_polyfill`](https://developer.wordpress.org/reference/functions/wp_get_script_polyfill/) instead. ## 4.5.0 - `Dropdown.refresh()` has been deprecated as the contained `Popover` is now automatically refreshed. diff --git a/lib/client-assets.php b/lib/client-assets.php index 3d5045e3fe67cc..469310edbe118c 100644 --- a/lib/client-assets.php +++ b/lib/client-assets.php @@ -43,27 +43,10 @@ function gutenberg_url( $path ) { * @return string Conditional polyfill inline script. */ function gutenberg_get_script_polyfill( $tests ) { - global $wp_scripts; - - $polyfill = ''; - foreach ( $tests as $test => $handle ) { - if ( ! array_key_exists( $handle, $wp_scripts->registered ) ) { - continue; - } - - $polyfill .= ( - // Test presence of feature... - '( ' . $test . ' ) || ' . - // ...appending polyfill on any failures. Cautious viewers may balk - // at the `document.write`. Its caveat of synchronous mid-stream - // blocking write is exactly the behavior we need though. - 'document.write( \'