Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit 4f65ccb

Browse files
committed
Fix missing alt attribute not added in some cases.
1 parent 5f370c2 commit 4f65ccb

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

lib/imageset.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -889,17 +889,14 @@ public function srcAttributes($options = null, $noscript = false) {
889889
*/
890890
public function altAttribute($options = null) {
891891
$options = array_merge($this->options, is_array($options) ? $options : []);
892-
$alt = $options['alt'];
893892

894-
if(empty($alt)) {
895-
return 'alt=""';
893+
if($options['output.xhtml']) {
894+
$alt = html::encode($options['alt'], false);
896895
} else {
897-
if($options['output.xhtml']) {
898-
return html::attr('alt', html::encode($alt, false));
899-
} else {
900-
return html::attr('alt', htmlspecialchars($alt));
901-
}
896+
$alt = htmlspecialchars($options['alt']);
902897
}
898+
899+
return 'alt="' . trim($alt) . '"';
903900
}
904901

905902

0 commit comments

Comments
 (0)