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

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

    XMLWordPrintable

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 4.0.6, 4.1.1
    • None
    • JavaScript
    • MOODLE_400_STABLE, MOODLE_401_STABLE

    Description

      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'.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              timhunt Tim Hunt
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: