Title: Supposed bug: invalid HTML (
Last modified: November 20, 2019

---

# Supposed bug: invalid HTML (

 *  [Nonverbis](https://wordpress.org/support/users/nonverbis/)
 * (@nonverbis)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/supposed-bug-invalid-html/)
 * NewsMag (not PRO) version: 2.4.1
    WordPress: 5.2.4
 * Widget NewsMag Posts Column generates HTML that is not valid according to [https://validator.w3.org/](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" /><noscr
       ```
   
 * Please, have a look at the result of the validation: [](https://yadi.sk/d/crcBNf2WjoEHcw)
   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.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [Nonverbis](https://wordpress.org/support/users/nonverbis/)
 * (@nonverbis)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/supposed-bug-invalid-html/#post-12156656)
 * Pardon. [The result of validation](https://yadi.sk/d/crcBNf2WjoEHcw)
    -  This reply was modified 6 years, 4 months ago by [Nonverbis](https://wordpress.org/support/users/nonverbis/).
 *  [Miha](https://wordpress.org/support/users/mplusb/)
 * (@mplusb)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/supposed-bug-invalid-html/#post-12158382)
 * Hello [@nonverbis](https://wordpress.org/support/users/nonverbis/),
 * Thank you for letting us know.
    I have forwarded your feedback to our dev team
   and they will investigate and fix in our next update.
 * Thank so much,
    Mihaela

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Supposed bug: invalid HTML (’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/newsmag/2.4.4/screenshot.jpg)
 * NewsMag
 * [Support Threads](https://wordpress.org/support/theme/newsmag/)
 * [Active Topics](https://wordpress.org/support/theme/newsmag/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/newsmag/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/newsmag/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Miha](https://wordpress.org/support/users/mplusb/)
 * Last activity: [6 years, 4 months ago](https://wordpress.org/support/topic/supposed-bug-invalid-html/#post-12158382)
 * Status: not resolved