Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-16583 Clean up JavaScript usage in HEAD
  3. MDL-16693

Change require_js so JavaScript is included in the page footer by default, but with an option to output it sooner

    XMLWordPrintable

Details

    • Sub-task
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0
    • 2.0
    • Libraries
    • None
    • MOODLE_20_STABLE
    • MOODLE_20_STABLE

    Description

      The advice about improving the performance of web pages is to put the JavaScript in the footer of the page. This lets the actual content can load more quickly, so the user can get on with things. JavaScript that just sets up event handlers, and the libraries required to do this, can safely be loaded later.

      Therefore, add an optional $loadimmediately argument to require_js that defaults to false. When it is false, the include link is only printed in the page footer. When it is true, the link is output according to the current logic.

      Attachments

        Activity

          People

            timhunt Tim Hunt
            timhunt Tim Hunt
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              24/Nov/10