WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#31111 closed defect (bug) (worksforme)

jQuery UI errors when using bundled UI and Effects

Reported by: awarren Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.1
Component: General Keywords:
Focuses: ui, javascript Cc:

Description

While trying to use jQuery UI Effects I kept receiving an error (see screenshot) when I was using the bundled copy of jQuery UI and jQuery UI Effects. I don't know what the error is or how to fix it, but if I swap out a fresh downloaded full copy of jQuery UI in place of the bundled copy then my code worked, and there were no errors.

It gave the error with no other plugins activated and using the default theme.

Possible bug?

http://build.andywarren1.com/wp-content/uploads/2015/01/Screen-Shot-2015-01-23-at-9.52.47-AM.png

Attachments (1)

aw-simple-sorter.zip (70.0 KB) - added by awarren 5 years ago.
Plugin files

Download all attachments as: .zip

Change History (6)

#1 follow-up: @ocean90
5 years ago

  • Keywords reporter-feedback added

Hello awarren, welcome to Trac.

Can you please provide a simple plugin or some code so we can reproduce the issue?

Since [29847] we build the minified files by ourselves, so there could be indeed an issue.

#2 in reply to: ↑ 1 @awarren
5 years ago

Replying to ocean90:

Hello awarren, welcome to Trac.

Can you please provide a simple plugin or some code so we can reproduce the issue?

Since [29847] we build the minified files by ourselves, so there could be indeed an issue.

This is the site I was getting the error on: http://build.andywarren1.com/simple-sorter/ It currently has the fresh new copy of jQuery UI enqueued rather than the bundled copy.

I'm trying to build a plugin, and that's how I was getting the error. I'll attach a copy of the plugin above so you can try to reproduce it.

@awarren
5 years ago

Plugin files

#3 @ocean90
5 years ago

I couldn't reproduce the issue. jquery-effects-core includes only the core functionalty. You've to enqueue each effect you want to use too. Something like this should work in your plugin:

	$dependencies = array( 'jquery-ui-core', 'jquery-effects-core' );
	switch ( $a['animation'] ) {
		case 'fade' :
			$dependencies[] = 'jquery-effects-fade';
			break;
		case 'scale' :
			$dependencies[] = 'jquery-effects-scale';
			// No break because scale needs size too
		case 'size' :
			$dependencies[] = 'jquery-effects-size';
			break;
	}

	// enqueue custom jQuery and localize the script
	wp_enqueue_script( 'aw_simple_sorter_js', plugin_dir_url( __FILE__ ) . 'js/aw_simple_sorter.js', $dependencies );

Can you still reproduce this with the changes above? Is this specific to a browser?

#4 @awarren
5 years ago

  • Resolution set to worksforme
  • Status changed from new to closed

I do not receive the error when enqueuing each individual effect. I was unaware of the need to enqueue each individual effect along with the UI Effects Core. Apologies for the Trac ticket, actually thought I'd found a possible bug.

#5 @SergeyBiryukov
5 years ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.