WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#29834 closed defect (bug) (wontfix)

jQuery UI admin files cannot be changed by plugins if SCRIPT_DEBUG is off

Reported by: Fab1en Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.1
Component: External Libraries Keywords:
Focuses: javascript Cc:

Description

I was trying to replace jQuery UI core files to use a more recent version, when I realized that SCRIPT_DEBUG must be true to make this work.

Here is the code I use :

add_action('wp_default_scripts', 'jqui_update_register', 10, 1);
function jqui_update_register($scripts){
	$scripts->remove( 'jquery-ui-draggable' );
	$scripts->add( 'jquery-ui-draggable', plugins_url('js/jquery.ui.draggable.min.js', __FILE__ ), array('jquery-ui-core', 'jquery-ui-mouse'), '1.11.1', 1 );
	// add plugin dir to the default list
	$scripts->default_dirs[] = plugins_url("js/", __FILE__ );
}

The issue is that core js files are loaded via wp-admin/load-scripts.php where actions and filters are disabled (for performance reasons ?).

Changeset [23378] makes it more difficult to accidentally or negligently deregister critical scripts in the admin, but does it does not prevent it completely.

I am doing it wrong ? Is it the intended behavior, or is it a bug ? If it is intended, it's tricky, because developers usually test their work with SCRIPT_DEBUG on.

Change History (1)

#1 @helen
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

It was on purpose.

Note: See TracTickets for help on using tickets.