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

`debugging` calls made before the theme chooses the Doctype, results in a quirks-mode rendered webpage

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 5.0
    • Text editor TinyMCE, Themes
    • None
    • MOODLE_500_STABLE

      Good day team,

      It's been known that `debugging` calls are important, and are an important part of the codebase development.

      Though that might be true, there is a number of occasions where that may bring trouble. This issue exposes one such occasion.

      When `debugging` calls are rendered on the webpage, and any `debugging` call is made before the theme has a chance to call `$OUTPUT->doctype()` or determine the Doctype in any way, then the whole page is rendered in quirks-mode.

      Quirks-mode has some impacts, most notably, the Tiny editor doesn't load on quirks-mode. Here is an example image of this situation:

      As can be seen right above, what is happening is that the debugging HTML is being placed right at the start of the document, even before the Doctype. You can see this in the Response tab on the image. You can also see a Tiny editor missing (only a blank place appears in front of where it says "Description").

      Preconditions

      1. Paste this code: `debugging('Hello Moodle');` into course/modedit.php, after the `require_once("../config.php");` line (or after the requires block).

      Steps to replicate

      1. Log in as admin.
      2. Go to a course or create one.
      3. Turn on edit mode.
      4. Click to add an assignment (don't add it just yet, don't Save it).
      5. Observe the Tiny editor.

      Observed behavior

      The Tiny editor for the Description of the assignment does not appear because of quirks-mode.

      Expected behavior

      The page is not rendered in quirks-mode, and its doctype is set at the top of the document. The Tiny editor for the Description of the assignment is displayed correctly.

      Potential solutions

      Maybe store (but not echo) the `debugging` output, and perform the actual output at a proper location, after the Doctype is set.

            Unassigned Unassigned
            julian.tovar Julian Tovar
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.