MDL-77865 qtype_ddwtos: fix incorrect inplace class

This commit is contained in:
Nathan Nguyen 2023-05-29 11:38:05 +10:00
parent 76fe404dd5
commit 35f0386bd3
3 changed files with 9 additions and 3 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -363,6 +363,12 @@ define([
* @param {jQuery} drop the place to put it.
*/
DragDropToTextQuestion.prototype.sendDragToDrop = function(drag, drop) {
// Send drag home if there is no place in drop.
if (this.getPlace(drop) === null) {
this.sendDragHome(drag);
return;
}
// Is there already a drag in this drop? if so, evict it.
var oldDrag = this.getCurrentDragInPlace(this.getPlace(drop));
if (oldDrag.length !== 0) {
@ -663,7 +669,7 @@ define([
*/
DragDropToTextQuestion.prototype.getClassnameNumericSuffix = function(node, prefix) {
var classes = node.attr('class');
if (classes !== '') {
if (classes !== undefined && classes !== '') {
var classesArr = classes.split(' ');
for (var index = 0; index < classesArr.length; index++) {
var patt1 = new RegExp('^' + prefix + '([0-9])+$');