Skip to content

Commit

Permalink
fix: correctly mangle img/@usemap
Browse files Browse the repository at this point in the history
  • Loading branch information
MHajoha committed Sep 14, 2023
1 parent 7ee1cde commit a78bf06
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion classes/question_ui_renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,12 @@ private function mangle_ids_and_names(\DOMXPath $xpath, question_attempt $qa): v
//xhtml:img/@usemap
") as $attr) {
$original = $attr->value;
$attr->value = $qa->get_qt_field_name($original);
if ($attr->name === "usemap" && utils::str_starts_with($original, "#")) {
// See https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/useMap.
$attr->value = "#" . $qa->get_qt_field_name(substr($original, 1));
} else {
$attr->value = $qa->get_qt_field_name($original);
}
}
}

Expand Down

0 comments on commit a78bf06

Please sign in to comment.