WordPress.org

Make WordPress Core

Ticket #49360: url-polyfill.diff

File url-polyfill.diff, 4.6 KB (added by aduth, 13 months ago)
  • src/wp-includes/script-loader.php

    diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php
    index 668ffee456..4b25665364 100644
    a b function wp_default_packages_vendor( &$scripts ) { 
    8686                'wp-polyfill-fetch',
    8787                'wp-polyfill-formdata',
    8888                'wp-polyfill-node-contains',
     89                'wp-polyfill-url',
    8990                'wp-polyfill-element-closest',
    9091                'wp-polyfill',
    9192        );
    function wp_default_packages_vendor( &$scripts ) { 
    9899                'wp-polyfill-fetch'           => '3.0.0',
    99100                'wp-polyfill-formdata'        => '3.0.12',
    100101                'wp-polyfill-node-contains'   => '3.26.0-0',
     102                'wp-polyfill-url'             => '3.26.0-0',
    101103                'wp-polyfill-element-closest' => '2.0.2',
    102104                'wp-polyfill'                 => '7.4.4',
    103105        );
    function wp_default_packages_vendor( &$scripts ) { 
    122124                        array(
    123125                                '\'fetch\' in window' => 'wp-polyfill-fetch',
    124126                                'document.contains'   => 'wp-polyfill-node-contains',
     127                                'window.URL'          => 'wp-polyfill-url',
    125128                                'window.FormData && window.FormData.prototype.keys' => 'wp-polyfill-formdata',
    126129                                'Element.prototype.matches && Element.prototype.closest' => 'wp-polyfill-element-closest',
    127130                        )
  • tests/phpunit/tests/dependencies/scripts.php

    diff --git a/tests/phpunit/tests/dependencies/scripts.php b/tests/phpunit/tests/dependencies/scripts.php
    index 16846147da..12002426cd 100644
    a b JS; 
    717717                $expected .= "<script type='text/javascript' src='http://example.com'></script>\n";
    718718                $expected .= "<script type='text/javascript' src='/wp-includes/js/dist/vendor/wp-polyfill.min.js'></script>\n";
    719719                $expected .= "<script type='text/javascript'>\n";
    720                 $expected .= "( 'fetch' in window ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-fetch.min.js\"></scr' + 'ipt>' );( document.contains ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-node-contains.min.js\"></scr' + 'ipt>' );( window.FormData && window.FormData.prototype.keys ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-formdata.min.js\"></scr' + 'ipt>' );( Element.prototype.matches && Element.prototype.closest ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-element-closest.min.js\"></scr' + 'ipt>' );\n";
     720                $expected .= "( 'fetch' in window ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-fetch.min.js\"></scr' + 'ipt>' );( document.contains ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-node-contains.min.js\"></scr' + 'ipt>' );( window.URL ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-url.min.js\"></scr' + 'ipt>' );( window.FormData && window.FormData.prototype.keys ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-formdata.min.js\"></scr' + 'ipt>' );( Element.prototype.matches && Element.prototype.closest ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-element-closest.min.js\"></scr' + 'ipt>' );\n";
    721721                $expected .= "</script>\n";
    722722                $expected .= "<script type='text/javascript' src='/wp-includes/js/dist/dom-ready.min.js'></script>\n";
    723723                $expected .= "<script type='text/javascript' src='/wp-includes/js/dist/a11y.min.js'></script>\n";
  • tools/webpack/packages.js

    diff --git a/tools/webpack/packages.js b/tools/webpack/packages.js
    index ab9e2fdef1..fe165da0c5 100644
    a b module.exports = function( env = { environment: 'production', watch: false, buil 
    7373                'wp-polyfill-fetch.js': 'whatwg-fetch/dist/fetch.umd.js',
    7474                'wp-polyfill-element-closest.js': 'element-closest/element-closest.js',
    7575                'wp-polyfill-node-contains.js': 'polyfill-library/polyfills/Node/prototype/contains/polyfill.js',
     76                'wp-polyfill-url.js': 'polyfill-library/polyfills/URL/polyfill.js',
    7677                'wp-polyfill-formdata.js': 'formdata-polyfill/FormData.js',
    7778                'moment.js': 'moment/moment.js',
    7879                'react.js': 'react/umd/react.development.js',
    module.exports = function( env = { environment: 'production', watch: false, buil 
    9293                'wp-polyfill-fetch.min.js': 'whatwg-fetch/dist/fetch.umd.js',
    9394                'wp-polyfill-element-closest.min.js': 'element-closest/element-closest.js',
    9495                'wp-polyfill-node-contains.min.js': 'polyfill-library/polyfills/Node/prototype/contains/polyfill.js',
     96                'wp-polyfill-url.min.js': 'polyfill-library/polyfills/URL/polyfill.js',
    9597        };
    9698
    9799        const blockNames = [