Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-10249

No way to reliably add JavaScript onload handlers

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: 1.9
    • Component/s: Libraries
    • Labels:
      None
    • Database:
      Any
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      It is not possible for included JavaScript code to add an onload handler in reliable or standard manner, because the body tag might have onload="setfocus()" added, which overwrites the JS-set handler. Also, if you have a case where two different pieces of code set an onload handler, these will overwrite each other even if setfocus is not used.

      I'm going to write a utility JavaScript function addonload() that can add a function to be called onload, and change the focus code to use this instead of the body tag. $focus will then be set to false so the theme doesn't mess it up again.

        Attachments

          Activity

            People

            • Assignee:
              quen Sam Marshall
              Reporter:
              quen Sam Marshall
              Tester:
              Nobody
              Participants:
              Component watchers:
              Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                3/Mar/08