Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#52972 closed defect (bug) (invalid)

WordPress background report jQuery error

Reported by: jack960330's profile jack960330 Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.7
Component: General Keywords: has-patch
Focuses: ui Cc:

Description

Here I have the following error:

https://files.slack.com/files-pri/T024MFP4J-F01TZEHPHNC/image.png

Upon investigation, it appears to be the following two documents:

wp-includes/js/jquery/jquery.js 
wp-includes/js/jquery/jquery.min.js

The following calls exist:

jQuery.noConflict()

Since the backend core of WordPress seems to already use jQuery instead of $, I think I can remove this call

The temporary solution is to delete it

Attachments (1)

1.png (93.4 KB) - added by jack960330 4 years ago.

Download all attachments as: .zip

Change History (6)

@jack960330
4 years ago

This ticket was mentioned in PR #1169 on WordPress/wordpress-develop by jack9603301.


4 years ago
#1

  • Keywords has-patch added

We think that jQuery is already used in WordPress, so it makes no sense to enable noConflict mode

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

This ticket was mentioned in Slack in #core by jack960330. View the logs.


4 years ago

#3 @Clorith
4 years ago

Hiya,

Looking at your original issue, something appears to have modified the load order on your site, as jQuery is a dependency of the jQuery UI library (that those files causing errors originate with).

If you need help troubleshooting or resolving this, I would recommend creating a support forum post, where our support volunteers can help you out.

As for your followup on noConflict; this problem would not be resolved by not using noConflict, as that is a feature that makes jQuery not automatically bind to the $ shortcut.

The reason for core explicitly declaring noConflict is that multiple libraries use the $ shortcut, and binding it to WordPress directly has the potential to break plugins or themes.

Related #16494

#4 @jack960330
4 years ago

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

I reviewed my problem and although it was fixed by this method at the time, in the latest test, the problem disappeared, perhaps because of configuration issues that caused jQuery to not be loaded in a particular order. Sorry, this PR will be turned off

#5 @SergeyBiryukov
4 years ago

  • Milestone Awaiting Review deleted

Thanks for the follow-up!

Note: See TracTickets for help on using tickets.