WordPress.org

Make WordPress Core

#51171 closed defect (bug) (duplicate)

Properly deprecate removed JavaScript globals

Reported by: joostdevalk Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description

In WordPress 5.5 the following global JavaScript objects were removed without being deprecated:

  • wp.updates.l10n
  • wpPointerL10n
  • commonl10n
  • userProfileL10n
  • privacyToolsL10n
  • authcheckL10n
  • wp.themePluginEditor.l10n
  • tagsl10n
  • adminCommentsL10n
  • tagsSuggestL10n
  • wpColorPickerL10n
  • attachMediaBoxL10n
  • postL10n
  • inlineEditL10n
  • plugininstallL10n
  • navMenuL10n
  • commentL10n
  • setPostThumbnailL10n

This means that referencing these objects will now result in a JavaScript error and will thus halt JavaScript execution.

Some of these objects were being used in very popular plugins. @omarreiss and I have been researching where these were used. This Google sheet shows the impact.

If we only count plugins with more than 100k installs or more, some of these already have an incredible impact. We should patch this as soon as possible. Our proposal is to make them fail silently: return an empty string and throw a console warning. This makes sure that JavaScript doesn't break, and also makes clear to plugin developers that they need to adapt.

For the globals that are removed entirely, we can do the deprecation in common.js. For the globals that were properties on another global, we have to do the deprecation in the file that holds the parent global.

Change History (1)

#1 @ocean90
11 months ago

  • Milestone 5.5.2 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Closing as a duplicate of #51123 to keep the discussion in one place.

Note: See TracTickets for help on using tickets.