View Issue Details

IDProjectCategoryView StatusLast Update
0013285mantisbtperformancepublic2015-09-11 11:29
ReportercarpiiAssigned Tosyncguru 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.3.0-beta.1 
Target Version1.3.0-beta.3Fixed in Version1.3.0-beta.3 
Summary0013285: Move script inclusions from HEAD to document footer
Description

Since mantis imports jquery and jquery.ui in via HEAD, this causes the browser to block until both scripts have been downloaded and parsed

By moving all scripts from the HEAD tag into the document footer, this creates a dramatic improvement on the perceived rendering time of all mantis pages.

I have done testing with this, and believe it causes no side effects since $document.ready() takes care of it

I have attached a git patch, sorry Im unable to submit a proper pull request

Tagspatch

Relationships

related to 0019932 closedvboctor Load jquery from CDN 
related to 0020081 closeddregad Moving JS to bottom is causing 'ReferenceError: jQuery is not defined' errors 
related to 0020088 closeddregad slow hiding of project-selector, filters 

Activities

carpii

carpii

2011-09-01 19:05

reporter  

head_to_toe.txt (2,105 bytes)
From 2eb0e00209bed4960a29ca2bf66aa7b063f6354e Mon Sep 17 00:00:00 2001
From: Carpii <p.chapman.uk@gmail.com>
Date: Thu, 1 Sep 2011 23:34:12 +0100
Subject: [PATCH] Move scripts to document footer instead of head,
 dramatically improves percieved rendering time

---
 core/html_api.php |   27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/core/html_api.php b/core/html_api.php
index 66a946d..152c88f 100644
--- a/core/html_api.php
+++ b/core/html_api.php
@@ -419,17 +419,8 @@ function require_js( $p_script_path ) {
  * @return null
  */
 function html_head_javascript() {
-	if ( config_get( 'use_javascript' ) ) {
-		global $g_scripts_included;
-		echo "\t<script type=\"text/javascript\" src=\"" . helper_mantis_url( 'javascript_config.php' ) . '"></script>' . "\n";
-		echo "\t<script type=\"text/javascript\" src=\"" . helper_mantis_url( 'javascript_translations.php' ) . '"></script>' . "\n";
-		html_javascript_link( 'jquery.js' );
-		html_javascript_link( 'jquery-ui.js' );
-		html_javascript_link( 'common.js' );
-		foreach ( $g_scripts_included as $t_script_path ) {
-			html_javascript_link( $t_script_path );
-		}
-	}
+	// 2011/09/01.CARP - Move javascript inclusions into html_body_end()
+	return;
 }
 
 /**
@@ -690,6 +681,20 @@ function html_footer( $p_file = null ) {
  * @return null
  */
 function html_body_end() {
+
+	// 2011/09/01.CARP - move selected javascripts out of HEAD and into bottom of document
+	if ( config_get( 'use_javascript' ) ) {
+		global $g_scripts_included;
+		echo "\t<script type=\"text/javascript\" src=\"" . helper_mantis_url( 'javascript_config.php' ) . '"></script>' . "\n";
+		echo "\t<script type=\"text/javascript\" src=\"" . helper_mantis_url( 'javascript_translations.php' ) . '"></script>' . "\n";
+		html_javascript_link( 'jquery.js' );
+		html_javascript_link( 'jquery-ui.js' );
+		html_javascript_link( 'common.js' );
+		foreach ( $g_scripts_included as $t_script_path ) {
+			html_javascript_link( $t_script_path );
+		}
+	}
+
 	event_signal( 'EVENT_LAYOUT_BODY_END' );
 
 	echo '</div>', "\n";
-- 
1.7.6
head_to_toe.txt (2,105 bytes)
syncguru

syncguru

2015-05-03 21:26

developer   ~0050690

Pull request: https://github.com/mantisbt/mantisbt/pull/605

dregad

dregad

2015-09-07 10:56

developer   ~0051385

This causes a regression for plugins relying on jQuery, see 0020081

Related Changesets

MantisBT: master 4a81ef15

2015-05-03 21:22:25

syncguru


Committer: dregad Details Diff
Move script inclusions from HEAD to document footer

Fixes 0013285: Move script inclusions from HEAD to document footer
mod - core/html_api.php Diff File

MantisBT: master 8d7ea37e

2015-09-11 10:03:14

dregad

Details Diff
Revert move-js-to-footer

This change (see issue 0013282) introduced several regressions.

This reverts commit 2dbc86b10d10495f1312b781fe0a3519a0d7152a, reversing
changes made to aa9b4f8ad7908325633542840805c4c854adb1f1.

Fixes 0020081, 0020088
mod - core/html_api.php Diff File

Issue History

Date Modified Username Field Change
2011-09-01 19:05 carpii New Issue
2011-09-01 19:05 carpii File Added: head_to_toe.txt
2014-10-11 04:48 grangeway Assigned To => grangeway
2014-10-11 04:48 grangeway Status new => assigned
2014-10-12 16:32 grangeway Product Version git trunk => 1.3.0-beta.1
2014-11-07 17:03 atrol Tag Attached: patch
2014-11-07 17:03 atrol Assigned To grangeway =>
2014-11-07 17:03 atrol Status assigned => new
2014-11-07 17:03 atrol Category html => performance
2014-11-25 10:58 vboctor Assigned To => vboctor
2014-11-25 10:58 vboctor Status new => assigned
2015-02-19 12:21 vboctor Assigned To vboctor => syncguru
2015-03-02 08:04 vitsaadmin Issue cloned: 0019425
2015-05-03 21:26 syncguru Note Added: 0050690
2015-07-14 10:12 vboctor Relationship added related to 0019932
2015-08-20 05:23 dregad Changeset attached => MantisBT master 4a81ef15
2015-08-20 05:23 dregad Assigned To syncguru => dregad
2015-08-20 05:23 dregad Status assigned => resolved
2015-08-20 05:23 dregad Resolution open => fixed
2015-08-20 05:23 dregad Fixed in Version => 1.3.0-beta.3
2015-08-20 05:27 dregad Assigned To dregad => syncguru
2015-08-20 05:27 dregad Target Version => 1.3.0-beta.3
2015-09-06 17:37 vboctoradmin Status resolved => closed
2015-09-07 10:40 dregad Relationship added related to 0020081
2015-09-07 10:56 dregad Note Added: 0051385
2015-09-09 01:57 atrol Relationship added related to 0020088
2015-09-11 11:29 dregad Changeset attached => MantisBT master 8d7ea37e