[wp-trac] [WordPress Trac] #49360: Scripts: Add polyfill for window.URL

WordPress Trac noreply at wordpress.org
Fri Feb 7 21:35:15 UTC 2020


#49360: Scripts: Add polyfill for window.URL
---------------------------+------------------------------
 Reporter:  aduth          |       Owner:  (none)
     Type:  enhancement    |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Script Loader  |     Version:
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:  javascript
---------------------------+------------------------------

Comment (by aduth):

 While not strictly related to the original ticket purpose, it was brought
 to my attention that there is another feature which requires polyfilling
 in the Gutenberg changes coming with WordPress 5.4.0. Notably, a few of
 the editor components make use of `window.DOMRect`, which is not supported
 in Internet Explorer or the pre-Chromium Microsoft Edge:

 https://developer.mozilla.org/en-
 US/docs/Web/API/DOMRect#Browser_compatibility

 There is a corresponding Gutenberg pull request at:
 https://github.com/WordPress/gutenberg/pull/20110

 The same polyfill library used for `Node#contains` and `URL` also includes
 a polyfill for `DOMRect`. However, it was added in a version later than
 the one currently used in WordPress. Thus, it requires bumping the
 dependency.

 The patch at [attachment:"49360-url-dom-rect-polyfills.diff"] includes a
 combination of the `URL` and `DOMRect` polyfills, both sourced from
 `polyfill-library`. It also bumps the `polyfill-library` dependency.

 **NOTE:** The patch does not include expected changes to `package-
 lock.json`, since these may be more prone to conflicts in applying the
 patch, and anecdotally I had observed some unexpected and unrelated
 changes when running `npm install` (possibly due to differing versions of
 NPM in use by contributors).

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49360#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list