From 7ba7920aa83c930e8ab6d3c8675329d58dd16418 Mon Sep 17 00:00:00 2001 From: Shamim Rezaie Date: Wed, 11 Aug 2021 15:38:11 +1000 Subject: [PATCH] MDL-70721 output: Remove redundant title The format_string() function does half html escaping. It escapes < and > characters, but does not escape ". Therefore, it put us in a situation where neither {{}}, nor {{{}}} are suitable in templates. If we use {{}} for an attribute (like title or aria-label), then < and > characters will be double escaped. On the other hand, if we use {{{}}} there, a double quote character will break HTML when it is used in an attribute. Therefore, neither {{}}, nore {{{}}} are usable in html attributes. Moreover, The title attribute here was redundant because it had the same value as the link's text. --- course/classes/output/activity_navigation.php | 2 -- lib/templates/action_link.mustache | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/course/classes/output/activity_navigation.php b/course/classes/output/activity_navigation.php index 84461428b6d..7412eaebbfa 100644 --- a/course/classes/output/activity_navigation.php +++ b/course/classes/output/activity_navigation.php @@ -74,7 +74,6 @@ class activity_navigation implements renderable, templatable { $attributes = [ 'class' => 'btn btn-link', 'id' => 'prev-activity-link', - 'title' => $linkname, ]; $this->prevlink = new \action_link($linkurl, $OUTPUT->larrow() . ' ' . $linkname, null, $attributes); } @@ -90,7 +89,6 @@ class activity_navigation implements renderable, templatable { $attributes = [ 'class' => 'btn btn-link', 'id' => 'next-activity-link', - 'title' => $linkname, ]; $this->nextlink = new \action_link($linkurl, $linkname . ' ' . $OUTPUT->rarrow(), null, $attributes); } diff --git a/lib/templates/action_link.mustache b/lib/templates/action_link.mustache index 0616c6345cb..fde8f5b52dc 100644 --- a/lib/templates/action_link.mustache +++ b/lib/templates/action_link.mustache @@ -52,11 +52,11 @@ } }} {{^disabled}} - {{#icon}}{{#pix}}{{key}}, {{component}}, {{title}}{{/pix}}{{/icon}}{{{text}}} + {{#icon}}{{#pix}}{{key}}, {{component}}, {{title}}{{/pix}}{{/icon}}{{{text}}} {{#hasactions}} {{> core/actions }} {{/hasactions}} {{/disabled}} {{#disabled}} - {{#icon}}{{#pix}}{{key}}, {{component}}, {{title}}{{/pix}}{{/icon}}{{{text}}} + {{#icon}}{{#pix}}{{key}}, {{component}}, {{title}}{{/pix}}{{/icon}}{{text}} {{/disabled}}