Skip to content

Commit bab8339

Browse files
authored
Merge pull request #1318 from drgrice1/fix-invalid-matrix-html
Fix invalid html for ans_array answers.
2 parents 80961b8 + 6a4dd45 commit bab8339

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

lib/Value/AnswerChecker.pm

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -555,57 +555,57 @@ sub format_matrix_HTML {
555555
my ($rows, $cols) = (scalar(@{$array}), scalar(@{ $array->[0] }));
556556
my $HTML = "";
557557
my $class = 'class="ans_array_cell"';
558-
my $cell = "display:table-cell;vertical-align:middle;";
558+
my $cell = "display:table-cell;vertical-align:middle;text-align:center;";
559559
my $pad = "padding:4px 0;";
560-
if ($sep) { $sep = '<span class="ans_array_sep" style="' . $cell . 'padding:0 2px">' . $sep . '</span>' }
561-
else { $sep = '<span class="ans_array_sep" style="' . $cell . 'width:8px"></span>' }
562-
$sep = '</span>' . $sep . '<span ' . $class . ' style="' . $cell . $pad . '">';
560+
if ($sep) { $sep = '<div class="ans_array_sep" style="' . $cell . 'padding:0 2px">' . $sep . '</div>' }
561+
else { $sep = '<div class="ans_array_sep" style="' . $cell . 'width:8px"></div>' }
562+
$sep = '</div>' . $sep . '<div ' . $class . ' style="' . $cell . $pad . '">';
563563

564564
if ($options{top_labels}) {
565565
$HTML .=
566-
'<span style="display:table-row"><span '
566+
'<div style="display:table-row"><div '
567567
. $class
568568
. ' style="'
569569
. $cell
570570
. $pad . '">'
571571
. join($sep, @{ $options{top_labels} })
572-
. '</span></span>';
572+
. '</div></div>';
573573
}
574574
foreach my $i (0 .. $rows - 1) {
575575
$HTML .=
576-
'<span style="display:table-row"><span '
576+
'<div style="display:table-row"><div '
577577
. $class
578578
. ' style="'
579579
. $cell
580580
. $pad . '">'
581581
. join($sep, EVALUATE(@{ $array->[$i] }))
582-
. '</span></span>';
582+
. '</div></div>';
583583
}
584-
$HTML = '<span class="ans_array_table" style="display:inline-table; vertical-align:middle">' . $HTML . '</span>';
584+
$HTML = '<div class="ans_array_table" style="display:inline-table; vertical-align:middle">' . $HTML . '</div>';
585585
$open = $self->format_delimiter($open, $rows, $options{tth_delims});
586586
$close = $self->format_delimiter($close, $rows, $options{tth_delims});
587587
if ($open ne '' || $close ne '') {
588588
my $delim = "display:inline-block; vertical-align:middle;";
589589
$HTML =
590-
'<span class="ans_array_open" style="'
590+
'<div class="ans_array_open" style="'
591591
. $delim
592592
. ' margin-right:4px">'
593593
. $open
594-
. '</span>'
594+
. '</div>'
595595
. $HTML
596-
. '<span class="ans_array_close" style="'
596+
. '<div class="ans_array_close" style="'
597597
. $delim
598598
. ' margin-left:4px">'
599599
. $close
600-
. '</span>';
600+
. '</div>';
601601
}
602-
return '<span class="ans_array" style="display:inline-block;vertical-align:.5ex"'
602+
return '<div class="ans_array" style="display:inline-block;vertical-align:.5ex"'
603603
. ($options{ans_last_name}
604604
? qq{ data-feedback-insert-element="$options{ans_last_name}" data-feedback-insert-method="append_content"}
605605
: '')
606606
. '>'
607607
. $HTML
608-
. '</span>';
608+
. '</div>';
609609
}
610610

611611
sub EVALUATE {

0 commit comments

Comments
 (0)