Supposed bug: invalid HTML (
-
NewsMag (not PRO) version: 2.4.1
WordPress: 5.2.4Widget NewsMag Posts Column generates HTML that is not valid according to https://validator.w3.org/
Error: The sizes attribute may be specified only if the srcset attribute is also present. From line 314, column 9; to line 314, column 576 >↩ <img width="65" height="65" src="http://ved/wp-content/uploads/2019/10/7aa97b86-ca24-11e9-9824-fa163…9/10/7aa97b86-ca24-11e9-9824-fa163e074e61-150x150.jpg 150w" sizes="(max-width: 65px) 100vw, 65px" /><noscrPlease, have a look at the result of the validation: There is full HTML there.
Condigion of the bug: Lazyload images should be On (In WordPress admin: Appearance/Customize/Theme options/General/Lazyload images/). When Lazyload images is off, the code is valid.
Possible places of bug localization:
1. wp-content/themes/newsmag/inc/libraries/class-newsmag-helper.php
Line 133.if ( $lazy ) { $img = apply_filters( 'newsmag_widget_image', $image_object ); }2. wp-content/themes/newsmag/inc/libraries/class-newsmag-lazyload.php
Line 49.function filter_lazyload_content( $content ) { // Perform a search for all images return preg_replace_callback( '/(<\s*img[^>]+)(src\s*=\s*"[^"]+")([^>]+>)/i', array( $this, 'preg_replace_callback_src', ), $content ); }This regular expression seems to be the problematic place. It seems to lack the srcset.
Please, doublecheck all other widgets as well.
If you need any assistance from me, please, contact me: tmpgmv (at) mail.ru.
The topic ‘Supposed bug: invalid HTML (’ is closed to new replies.
