Make WordPress Core

Opened 18 years ago

Closed 18 years ago

Last modified 8 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 Owned by:
Priority: normal Milestone: 2.8
Component: General Version:
Severity: normal Keywords: has-patch
Cc: Focuses:

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 18 years ago.
8628-2.patch​ (7.8 KB ) - added by azaozz 18 years ago.
8628-3.patch​ (9.2 KB ) - added by azaozz 18 years ago.
8628-4.patch​ (40.8 KB ) - added by azaozz 18 years ago.
8628-5.patch​ (40.6 KB ) - added by azaozz 18 years ago.

Download all attachments as: .zip

Change History (18)

#1 @mdawaffe
18 years ago

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

#2 @djr
18 years ago

  • Cc djr added

#3 @azaozz
18 years ago

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

#4 @azaozz
18 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
18 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
18 years ago

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

#8 @Viper007Bond
18 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
18 years ago

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

#10 @Denis-de-Bernardy
18 years ago

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

#11 @janeforshort
18 years ago

  • Keywords has-patch added

#12 @ryan
18 years ago

  • Resolution → fixed
  • Status new → closed

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


8 years ago

Note: See TracTickets for help on using tickets.