The code used to replace srcset and sizes attributes is overly simple and can cause issues like replacing parts of the src or other unrelated attributes:
// also replace the srcset (responsive images)
$replaceHTML = str_replace( 'srcset', 'data-lazy-srcset', $replaceHTML );
// replace sizes to avoid w3c errors for missing srcset
$replaceHTML = str_replace( 'sizes', 'data-lazy-sizes', $replaceHTML );
To fix this, we need to implement a proper parsing of the HTML tag and its attributes.
The issue was reported on wordpress.org: https://wordpress.org/support/topic/broken-image-10/
The code used to replace
srcsetandsizesattributes is overly simple and can cause issues like replacing parts of thesrcor other unrelated attributes:To fix this, we need to implement a proper parsing of the HTML tag and its attributes.
The issue was reported on wordpress.org: https://wordpress.org/support/topic/broken-image-10/