Make WordPress Core

Opened 16 years ago

Closed 16 years ago

Last modified 6 years ago

#8628 closed enhancement (fixed)

Extend class WP_Scripts to support concatenating, compressing and printing scripts in the HTML head and the footer

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

Description

Many Javascript functions can be loaded in the footer, making the page load faster. Perhaps we can split the current script queue in "head" and "foot" sections and use an extra param when queueing scripts. That way all dependencies and loading order would be preserved.

Alternatively can have two queues and exclude all dependency satisfying scripts that have been loaded in the "head" queue from the "foot" queue.

Attachments (5)

8628.patch (3.8 KB) - added by azaozz 16 years ago.
8628-2.patch (7.8 KB) - added by azaozz 16 years ago.
8628-3.patch (9.2 KB) - added by azaozz 16 years ago.
8628-4.patch (40.8 KB) - added by azaozz 16 years ago.
8628-5.patch (40.6 KB) - added by azaozz 16 years ago.

Download all attachments as: .zip

Change History (18)

#1 @mdawaffe
16 years ago

We should have only one queue. By that I mean only one WP_Scripts object. An extra parameter ought to work fine

@azaozz
16 years ago

@azaozz
16 years ago

@azaozz
16 years ago

#2 @djr
16 years ago

  • Cc djr added

@azaozz
16 years ago

@azaozz
16 years ago

#3 @azaozz
16 years ago

  • Summary changed from Extend class WP_Scripts to print scripts in both the HTML head and the footer to Extend class WP_Scripts to support concatenating, compressing and printing scripts in the HTML head and the footer

#4 @azaozz
16 years ago

(In [10357]) Split the script queue in head and footer part, concatenate and compress the default js and css, first run, see #8628

#6 @azaozz
16 years ago

(In [10442]) Improvements to the script loader: allows plugins to queue scripts for the front end head and footer, adds hooks for server side caching of compressed scripts, adds support for ENFORCE_GZIP constant (deflate is used by default since it's faster), see #8628, fixes #8884

#7 @azaozz
16 years ago

(In [10476]) Detect when the server compresses output, see #8628

#8 @Viper007Bond
16 years ago

Farbtastic completely breaks this script loader.

Steps To Reproduce:

  1. Download and activate my Video Quicktags plugin: http://wordpress.org/extend/plugins/vipers-video-quicktags/
  2. Visit Settings -> Video Quicktags in Firefox 3. Note page is there for a moment and then disappears. Disabling JS makes it appear fine.
  3. Comment out wp_enqueue_script( 'farbtastic', ... line in plugin. Page works as expected.

Checking JS error console shows these errors:

Error: S.documentElement is null
Source File: http://localhost/wordpress-dev/wp-admin/load-scripts.php?c=1&load=jquery,utils&ver=960edfac60367b8ae4d41cab123ae351
Line: 19
Error: document.body is null
Source File: http://localhost/wordpress-dev/wp-admin/load-scripts.php?c=1&load=jquery,utils&ver=960edfac60367b8ae4d41cab123ae351
Line: 19

#9 @azaozz
16 years ago

(In [10496]) Load farbtastic.js has to be loaded in the head, see #8628

#10 @Denis-de-Bernardy
16 years ago

also #9242 (the same for styles, and plugin scripts)

#11 @janeforshort
16 years ago

  • Keywords has-patch added

#12 @ryan
16 years ago

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

This ticket was mentioned in Slack in #core-editor by youknowriad. View the logs.


6 years ago

Note: See TracTickets for help on using tickets.