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

core/dragdrop JavaScript library should not require jQuery in its external API


    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 4.0.6, 4.1.1
    • JavaScript

      The core/dragdrop JavaScript library was added to Moodle at a time when jQuery was very much flavour-of-the-month.

      This means that, not only does this module use jQuery internally, but other code that wants to use it also has to use jQuery, becuse you need to pass jQuery objects to its a API.

      The question is, can we change that, without breaking backwards-compatibility? I think we could, like this:

      1. Change the public methods of this module (prepare and start) so they will accept either jQuery objects or plain DOM nodes (arguements event and dragProxy).
      2. And, when they are called, they need to record which sort of interaction the calling code wants. (Not quite clear where to store that. Possibly enough to just store this info in the start method, and it could be stored on the dragProxy.)
      3. When this module calls the provided callbacks onMove and onDrop, it passes the type of object (jQuery or plain) which were passed to it.

      The other option would be to make a new module for jQuery-less drag-drop, but hard to think of a better name than 'dragdrop'.

            Unassigned Unassigned
            timhunt Tim Hunt
            1 Vote for this issue
            2 Start watching this issue


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