Make WordPress Core


Ignore:
Timestamp:
03/03/2020 04:53:32 PM (5 years ago)
Author:
jorgefilipecosta
Message:

Scripts: Use core-js url as polyfill for window.URL.

URL polyfill from the polyfill-library library is not spec-conformant, in a way which negatively impacts its usability for pending revisions to the block editor. Specifically, there were revisions to the implementation of the wp-url script to detect URL validity by relying on thrown errors from the URL constructor, but this specific behavior is not implemented in this version of the polyfill.
There was another issue in r47238, which is that the test used to check whether the polyfill should be included is not accurate. This commit uses a different check and fixes the issue.

Props aduth.
Fixes: #49360.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/script-loader.php

    r47355 r47416  
    101101        'wp-polyfill-formdata'        => '3.0.12',
    102102        'wp-polyfill-node-contains'   => '3.42.0',
    103         'wp-polyfill-url'             => '3.42.0',
     103        'wp-polyfill-url'             => '3.6.4',
    104104        'wp-polyfill-dom-rect'        => '3.42.0',
    105105        'wp-polyfill-element-closest' => '2.0.2',
     
    127127                '\'fetch\' in window' => 'wp-polyfill-fetch',
    128128                'document.contains'   => 'wp-polyfill-node-contains',
    129                 'window.URL'          => 'wp-polyfill-url',
    130129                'window.DOMRect'      => 'wp-polyfill-dom-rect',
     130                'window.URL && window.URL.prototype && window.URLSearchParams' => 'wp-polyfill-url',
    131131                'window.FormData && window.FormData.prototype.keys' => 'wp-polyfill-formdata',
    132132                'Element.prototype.matches && Element.prototype.closest' => 'wp-polyfill-element-closest',
Note: See TracChangeset for help on using the changeset viewer.