WordPress.org

Make WordPress Core

Opened 4 months ago

Last modified 2 months ago

#52851 new enhancement

Update the `element-closest` polyfill

Reported by: desrosj Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: External Libraries Keywords: needs-testing has-patch needs-refresh
Focuses: Cc:

Description

The element-closest dependency is a polyfill used for the block editor. A new version is available so this should be updated.

What's not immediately clear is what this polyfill is used for and if it's still required. It's in the Gutenberg documentation, but is not defined as a dependency within that repository (most likely because it has been in Core for some time).

The update has relatively minor changes, but confirming that the areas of Core relying on this polyfill continue to work properly would be a good step to take.

Currently, version 2.0.2 is bundled with Core. The latest is now v3.0.2.

A full list of changes can be found on GitHub: https://github.com/jonathantneal/closest/blob/master/CHANGELOG.md#302-october-31-2019

Attachments (2)

52851.diff (1.6 KB) - added by desrosj 4 months ago.
52851.2.diff (1.6 KB) - added by desrosj 3 months ago.

Download all attachments as: .zip

Change History (8)

@desrosj
4 months ago

#1 @desrosj
4 months ago

  • Keywords has-patch needs-testing added
  • Type changed from defect (bug) to enhancement

This ticket was mentioned in Slack in #core-editor by desrosj. View the logs.


4 months ago

#3 @Hareesh Pillai
3 months ago

Patch looks good and the QUnit tests have all passed. Based on my testing of a few areas that use .closest, it seems to work fine.

I suggest that we commit this patch so that we could catch any edge cases.

@desrosj
3 months ago

#4 @desrosj
3 months ago

52851.2.diff is just a refresh to apply to trunk cleanly.

I was looking at this again today. It seems that the name of the file in the package has changed. Previously, the package contained an element-closest.js file that was used in the Webpack build process.

In the latest release, it seems that browser.js is the result of a new build process and is meant to replace this file. However, the file is also minified. Core currently has an expanded and minified version of wp-polyfill-element-closest.js, so this will need to be addressed in the build process.

#5 @gziolo
2 months ago

As far as I can tell we should be able to use one of the unminified files:

So we should need to update references in both vendors and minifiedVendors.

#6 @desrosj
2 months ago

  • Keywords needs-refresh added
  • Milestone changed from 5.8 to Future Release

This is not mission critical, and I have not had a chance to revisit this.

Going to punt.

Note: See TracTickets for help on using tickets.