- 🇬🇧United Kingdom lesleyfernandes
I checked the codebase, and it is already fixed.
The module always adds "alt" and "title" attributes for an image tag, even they are empty. I propose to skip these attributes if they are empty.
The easiest way is to update the theme_image_srcset() function. But I'm not sure that this update will not create other issues.
Another way is to refactor the theme_picture() (don't set 'alt' and 'title' keys if they are empty):
if (variable_get('picture_fallback_method', 'src') === 'src') {
$min_ie9_fallback = array(
'#theme' => 'image_srcset',
'#uri' => $src,
'#alt' => isset($attributes['alt']) ? $attributes['alt'] : '',
'#title' => isset($attributes['title']) ? $attributes['title'] : '',
'#attributes' => array_diff_key($attributes, array('alt' => '', 'title' => '')),
);
$output[] = drupal_render($min_ie9_fallback);
}
else {
// Fallback image for < IE9.
$min_ie9_fallback = array(
'#theme' => 'image_srcset',
'#uri' => $src,
'#alt' => isset($attributes['alt']) ? $attributes['alt'] : '',
'#title' => isset($attributes['title']) ? $attributes['title'] : '',
'#attributes' => array_diff_key($attributes, array('alt' => '', 'title' => '')),
);
$output[] = '<!--[if lt IE 9]>';
$output[] = drupal_render($min_ie9_fallback);
$output[] = '<![endif]-->';
// Fallback image for > IE8.
$srcset = array(
'uri' => $src,
);
$dimensions_clone = $dimensions;
picture_get_image_dimensions($variables['style_name'], $dimensions_clone);
if (!empty($dimensions_clone['width'])) {
$srcset['width'] = $dimensions_clone['width'] . 'w';
}
$plus_ie8_fallback = array(
'#theme' => 'image_srcset',
'#srcset' => array($srcset),
'#alt' => isset($attributes['alt']) ? $attributes['alt'] : '',
'#title' => isset($attributes['title']) ? $attributes['title'] : '',
'#attributes' => array_diff_key($attributes, array('alt' => '', 'title' => '')),
);
$output[] = '<!--[if !lt IE 9]><!-->';
$output[] = drupal_render($plus_ie8_fallback);
$output[] = '<!-- <![endif]-->';
}
Closed: outdated
2.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
I checked the codebase, and it is already fixed.