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.
This commit is contained in:
Shamim Rezaie 2021-08-11 15:38:11 +10:00
parent 652392d932
commit 7ba7920aa8
2 changed files with 2 additions and 4 deletions

View File

@ -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);
}

View File

@ -52,11 +52,11 @@
}
}}
{{^disabled}}
<a href="{{{url}}}" id="{{id}}" class="{{classes}}" {{#attributes}} {{name}}={{#quote}}{{value}}{{/quote}} {{/attributes}}>{{#icon}}{{#pix}}{{key}}, {{component}}, {{title}}{{/pix}}{{/icon}}{{{text}}}</a>
<a href="{{{url}}}" id="{{id}}" class="{{classes}}" {{#attributes}} {{name}}="{{value}}" {{/attributes}}>{{#icon}}{{#pix}}{{key}}, {{component}}, {{title}}{{/pix}}{{/icon}}{{{text}}}</a>
{{#hasactions}}
{{> core/actions }}
{{/hasactions}}
{{/disabled}}
{{#disabled}}
<span class="currentlink {{classes}}" {{#attributes}} {{name}}={{#quote}}{{value}}{{/quote}} {{/attributes}}>{{#icon}}{{#pix}}{{key}}, {{component}}, {{title}}{{/pix}}{{/icon}}{{{text}}}</span>
<span class="currentlink {{classes}}" {{#attributes}} {{name}}="{{value}}" {{/attributes}}>{{#icon}}{{#pix}}{{key}}, {{component}}, {{title}}{{/pix}}{{/icon}}{{text}}</span>
{{/disabled}}