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

Resources/Activities sometimes disappear during drag and drop

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.7
    • Fix Version/s: 1.7.1, 1.8
    • Component/s: JavaScript
    • Labels:
      None
    • Environment:
      Internet Explorer 6
    • Affected Branches:
      MOODLE_17_STABLE
    • Fixed Branches:
      MOODLE_17_STABLE, MOODLE_18_STABLE

      Description

      Sometimes while moving activities and resources around with drag and drop some of them will disappear.

      I seem to be able to reproduce this consistently with 2 items in a course. With one item in section 1 and 1 in section 2.

      1) Take the item in section 1 and drag it to section 2, below the item that is already there
      2) Now take the item you just placed in section 2 and drag it back up to section 1

      When I do this in IE 6 the item that should remain in section 2 disappears.

      The issue appears to be in section_class.prototype.remove_resource - the code that cleans up the text nodes is inadvertently deleting a complete list item in IE! I haven't really worked out the best way this text node clean up should be written, but would something simple like just clearing all text nodes from the list work?

      var c = el.getEl().parentNode.childNodes;
      var i = c.length;
      while (i--) {
      if (c[i].nodeType == 3)

      { c[i].parentNode.removeChild(c[i]); }

      }

      Not very well tested yet, but doesn't seem to have caused problems so far.

      Or perhaps just adding a text for nodeType == 3 in the existing code that removes the text node,

      if (childIndex > 0 && childIndex < this.resources_ul.childNodes.length && this.resources_ul.childNodes[childIndex - 1].nodeType == 3) {
      this.resources_ul.removeChild(this.resources_ul.childNodes[childIndex - 1]);
      }

      Any thoughts about this?

        Attachments

          Activity

            People

            Assignee:
            vyshane Vy-Shane Sin Fat
            Reporter:
            catbert Andrew Walker
            Tester:
            Nobody
            Participants:
            Component watchers:
            Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              17/Jan/07