Moodle

Split javascript-static.js into a small file included in <head> and the rest that can be included in the footer

Details

  • Type: Sub-task Sub-task
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 2.0
  • Fix Version/s: STABLE backlog
  • Component/s: Libraries
  • Labels:
  • Affected Branches:
    MOODLE_20_STABLE

Activity

Hide
Sam Hemelryk added a comment -

I've uploaded a patch here that cleans up the JavaScript that was being served within javascript-static.
This is done in several methods:

1. A couple of functions that were being used by only one module have been moved to JS files being included by those modules only
2. Several functions that were only being used by formslib have been split into a separate file lib/form/form.js
at the same time I also tidied up the JavaScript that formslib was serving in the corresponding places.
3. Deprecated a couple of JavaScript functions that weren't being used within Moodle at all.
4. Changed javascript-static to load in the page footer rather than the head
5. Created javascript-static-priority and moved several functions that were required (within at least one call) to be loaded in the head into javascript-static-priority and made output-render load the file in head.

If someone could please have a look at this patch and let me know if it is OK to commit that would be fantastic.
Cheers
Sam

Show
Sam Hemelryk added a comment - I've uploaded a patch here that cleans up the JavaScript that was being served within javascript-static. This is done in several methods: 1. A couple of functions that were being used by only one module have been moved to JS files being included by those modules only 2. Several functions that were only being used by formslib have been split into a separate file lib/form/form.js at the same time I also tidied up the JavaScript that formslib was serving in the corresponding places. 3. Deprecated a couple of JavaScript functions that weren't being used within Moodle at all. 4. Changed javascript-static to load in the page footer rather than the head 5. Created javascript-static-priority and moved several functions that were required (within at least one call) to be loaded in the head into javascript-static-priority and made output-render load the file in head. If someone could please have a look at this patch and let me know if it is OK to commit that would be fantastic. Cheers Sam
Hide
Sam Hemelryk added a comment -

As a note this patch reduces the amount of JavaScript being loaded in the head by about 32KB and slims down the overall JavaScript payload by 15KB for pages that don't use formslib

Show
Sam Hemelryk added a comment - As a note this patch reduces the amount of JavaScript being loaded in the head by about 32KB and slims down the overall JavaScript payload by 15KB for pages that don't use formslib
Hide
Martin Dougiamas added a comment -

Concept sounds good! I don't know if anything unexpected might break but assuming it doesn't (or that can be corrected easily) then +1 from me!

Show
Martin Dougiamas added a comment - Concept sounds good! I don't know if anything unexpected might break but assuming it doesn't (or that can be corrected easily) then +1 from me!
Hide
Sam Hemelryk added a comment -

Just putting this on hold until the new theme changes have come into effect, at which point I will again have a look at it

Show
Sam Hemelryk added a comment - Just putting this on hold until the new theme changes have come into effect, at which point I will again have a look at it
Hide
Eloy Lafuente (stronk7) added a comment -

NOTE: This issue was assigned to the STABLE backlog without complete triaging process. Marking it as triaged, but with this note for future reference.

Show
Eloy Lafuente (stronk7) added a comment - NOTE: This issue was assigned to the STABLE backlog without complete triaging process. Marking it as triaged, but with this note for future reference.

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated: