Make WordPress Core

Opened 4 weeks ago

Closed 3 weeks ago

#66061 closed enhancement (fixed)

Remove no longer used list-revisions.js file

Reported by: afercia Owned by: afercia
Priority: normal Milestone: 7.2
Component: Revisions Version:
Severity: normal Keywords: has-patch commit
Cc: Focuses: javascript

Description

While reviewing JS files in the context of #66033, I noticed the file src/js/_enqueues/lib/list-revisions.js which appears to not be used any longer.

It was introduced in [12500] / #11088 'to hide the radio buttons to stop you selecting reverse comparisions' for the post revisions.

That was in WordPress 3.0 where the revisions screen used a table with radio buttons. See attached screenshot.

That UI isn't used since ages and I believe the list-revisions.js can be safely removed.
Cc @adamsilverstein

Attachments (1)

01 old revisions screen.png​ (350.6 KB ) - added by afercia 4 weeks ago.

Download all attachments as: .zip

Change History (13)

#1 @sainathpoojary
4 weeks ago

Great find @afercia! I took a quick look and completely agree, this looks safe to remove.

Even though list-revisions is still registered in script-loader.php, it’s not actually enqueued or used as a dependency anywhere. Plus, the #post-revisions ID it targets is long gone from the DOM.

I'd be happy to put together a quick PR to drop the JS files and clean up the leftover references in script-loader.php and Gruntfile.js.

This ticket was mentioned in ​PR #13428 on ​WordPress/wordpress-develop by ​@sainathpoojary.


4 weeks ago
#2

  • Keywords has-patch added

This PR removes list-revisions.js and its related references, as it is no longer used in core.
As noted in the ticket, the script targets a #post-revisions ID containing radio inputs for the old WordPress 3.0 table based revisions screen. That UI was replaced in 3.6, and the ID no longer exists in the DOM. The script is also currently registered in script-loader.php but never enqueued anywhere.

This PR:

  • Deletes the src/js/_enqueues/lib/list-revisions.js file.
  • Removes the script registration from src/wp-includes/script-loader.php.
  • Cleans up the relevant build entries in Gruntfile.js.

Trac ticket: https://core.trac.wordpress.org/ticket/66061

#3 @adamsilverstein
4 weeks ago

+1, we can probably remove this. I'm surprised we din't already.

#4 @westonruter
4 weeks ago

  • Keywords changes-requested added

I ​searched Veloria for the script handle, and it surfaced one plugin in particular which appears to be using this: ​BuddyPress Docs.

See usage: ​https://github.com/boonebgorges/buddypress-docs/blob/2a3429ce5270e8c916b3a722078eb3b2ca54bc7e/includes/addon-history.php#L93

This ticket was mentioned in ​PR #13502 on ​WordPress/wordpress-develop by ​@micahele.


4 weeks ago
#5

## Summary

  • Remove the obsolete list-revisions.js source file.
  • Remove its two Grunt build mappings.
  • Remove the unused list-revisions script registration.

The legacy wp-list-revisions.dev.js entry in src/wp-admin/includes/update-core.php is retained because it is part of the historical upgrade cleanup list, not the current build or registration path.

## Testing

  • php -l src/wp-includes/script-loader.php
  • node --check Gruntfile.js
  • npm run grunt -- jshint:grunt
  • git diff --check

​@westonruter commented on ​PR #13502:


4 weeks ago
#6

@MicahelE Before opening a PR, please look to see if there is one already created. In this case, there was: ​https://github.com/WordPress/wordpress-develop/pull/13428

#7 @westonruter
4 weeks ago

  • Keywords close added

#8 @afercia
3 weeks ago

  • Keywords 2nd-opinion added; close removed

Usage from third parties seems to be very limited. On the other hand, keeping this file in Core doesn't harm anything.

Is there any established practice to actually deprecate an entire JS file? I would like this file to be at least deprecated.

At the very least, an inline comment in script-loader should be added, ​as done for other files.

#9 @westonruter
3 weeks ago

Just adding a comment to indicate it is no longer used in core makes sense to me.

#10 @sainathpoojary
3 weeks ago

Thanks everyone for the feedbacks! Based on our discussion, I've updated PR ​#13428 to retain the list-revisions script, its build mappings, and its registration to ensure we maintain backward compatibility.

The PR now just adds an inline comment in script-loader.php to clarify that the script is no longer used in Core. Let me know how this looks to you all!

#11 @afercia
3 weeks ago

  • Keywords commit added; changes-requested 2nd-opinion removed
  • Owner set to afercia
  • Status new → assigned

#12 @afercia
3 weeks ago

  • Resolution → fixed
  • Status assigned → closed

In 63620:

Revisions: Mark list-revisions.js as deprecated and no longer used in Core.

The list-revisions.js file is no longer used in Core. It was when the WordPress 3.0 releases were using a table with radio buttons in the Revisions screen. Since then the Revisions screen has been completely redesigned and there is no longer a table that is targeted by the jQuery selectors in list-revisions.js.
It appears a few plugins still use this file so that it needs to be kept for backward compatibility but the file is now deprecated and its usage is not recommended.

Developed in ​https://github.com/WordPress/wordpress-develop/pull/13428

Props sainathpoojary, westonruter, adamsilverstein, afercia.
Fixes #66061.

Note: See TracTickets for help on using tickets.