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

loader.js reference to "setup-lazy" that should be "data-setup-lazy"?



    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Not a bug
    • Affects Version/s: 3.5.4
    • Fix Version/s: None
    • Component/s: JavaScript
    • Labels:
    • Affected Branches:


      We integrate our Moodle with Poodll for video and audio recording.  After a Teacher adds a feedback audio recording to a Assignment Submission of a student. The left side of the grader page goes blank.  It's caused by a javascript error.  If the teacher navigates back to the submission from the view all submissions page the left side of the grader mostly loads, except for the Feedback files. It just spins again because of a javascript error.

      I started a ticket with Poodll but after digging I think it might be a typo in core's loader.js.

      The error was on first.js:168 according to Chrome.  In Chrome's Developer Tools, I used "Pretty Print" on first.js to make it readable. After prettying up the code, line 168 becomes the following lines of code. 
      define('media_videojs/loader', ["jquery", "core/event"], function(a, b) {
          var c, d = function(d) {
              c = d,
              e(null, a("body")),

      {             a(document).on(b.FILTER_CONTENT_UPDATED, e)         }

          }, e = function(b, d) {
              var e = ".mediaplugin_videojs";
              d.find(e).addBack(e).find("audio, video").each(function() {
                  var b = a(this).attr("id")
                    , d = a(this).data("setup-lazy")
                    , e = ["media_videojs/video-lazy"];
                  d.techOrder && d.techOrder.indexOf("youtube") !== -1 && e.push("media_videojs/Youtube-lazy"),
                  d.techOrder && d.techOrder.indexOf("flash") !== -1 && e.push("media_videojs/videojs-flash-lazy"),
                  require(e, function(a)

      {                 c && (c(a),                 c = null),                 a(b, d)             }


      {         setUp: d     }

      Comparing the code to the HTML Elements I notice the class .mediaplugin_videojs is found then all the audio (and video) tags within it. It then loops through each audio/video tag and tries to get .data() on "setup-lazy".  But "d" will be undefined because there is no "setup-lazy" attribute. BUT there IS a "data-setup-lazy" attribute.
      If I search our Moodle code base which includes all our Poodll plugins for "setup-lazy" I find 7 instances. None of which are in Poodll plugin files.  It's only referenced as setup-lazy on loader.js which gets minified into loader.min.js.  The other references use "data-setup-lazy" in plugin.php and playertest.php.
      At the moment I think this is a Moodle core issue because of a typo but I'm not 100% sure yet.  Since I can not recreate or debug this anywhere except our production server I hesitate to change loader.js, re-minify the code, and test it on production server.
      I'd change /media/player/videojs/amd/src/loader.js line 65
      config = $(this).data('setup-lazy'),
      config = $(this).data('data-setup-lazy'),

      Does anyone know a for sure if it should be "setup-lazy" or "data-setup-lazy"?





            • Assignee:
              swit Matthew G. Switlik
              Component watchers:
              Jake Dallimore, Jun Pataleta
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: