Make WordPress Core

Opened 12 years ago

Closed 3 years ago

#19979 closed enhancement (wontfix)

Load jQuery on the front end for logged-in users

Reported by: azaozz's profile azaozz Owned by: morganestes's profile morganestes
Milestone: Priority: normal
Severity: normal Version:
Component: Toolbar Keywords: needs-patch
Focuses: javascript Cc:


This will let us simplify the toolbar JS and improve user experience: hoverIntent, additions by plugins that require jQuery, etc.

jQuery can be loaded in two different ways:

  • Directly, by enqueueing it with script_loader and then adding wpjq = jQuery.noConflict(true); where true means other version of jQuery will be left with the globals.
  • By outputting some JS at the very end of 'wp_footer'. This JS would be able to check whether jQuery is already loaded and if not, load it by appending a <script src="..."> tag to the head (note that this method would load jQuery asynchronously).

Previous discussion in some of the comments on #18758.

Change History (9)

#2 @chriscct7
9 years ago

  • Keywords needs-patch added

#3 @johnbillion
9 years ago

#24655 was marked as a duplicate.

#4 @morganestes
8 years ago

  • Focuses javascript added
  • Milestone changed from Future Release to 4.5
  • Owner set to morganestes
  • Status changed from new to assigned

I think that it's time to revisit this and see how well it fits in with #32678 (I think it does). Getting it in early would certainly help with some other enhancements coming soon.

I'm in favor of loading core's version of jQuery using noConflict() without resorting to the extra inline script for fallback checks, but we should check to be sure the toolbar is displayed before enqueuing it (see #33165). We also need to allow for the fact that a theme or plugin may dequeue core's jQuery on the front end, and what that means for any JS we build that relies on core's version.

#5 @peterwilsoncc
8 years ago

As part of the scope for this, I'd like to investigate the reverse. Can the admin bar's JavaScript be simplified by removing the jQuery portion.

As jquery is two files, jquery-core and jquery-migrate, the end result would be three extra HTTP requests for the admin JS. It's a lot of code for the admin bar.

#6 @ocean90
8 years ago

  • Milestone changed from 4.5 to Future Release

#7 @SergeyBiryukov
7 years ago

#39784 was marked as a duplicate.

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

3 years ago

#9 @sabernhardt
3 years ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from assigned to closed

The toolbar no longer requires jQuery on the front end after #47069

Note: See TracTickets for help on using tickets.